Re: use strict; use warnings;

Discussion in 'Perl Misc' started by George Mpouras, Feb 24, 2014.

  1. here is some shuffle fun


    #!/usr/bin/perl
    use strict;
    use warnings;


    my @array = qw/a b c e r/;

    for (my $i=0; $i<scalar @array/2; $i++) {
    push @array, shift @array}

    for (my $i=$#array; $i>0; $i -= 2) {
    my $l1 = pop @array;
    my $l2 = pop @array;
    unshift @array, $l2;
    unshift @array, $l1}

    print "@array"
     
    George Mpouras, Feb 24, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marius Gavrilescu

    Re: use strict; use warnings;

    Marius Gavrilescu, Feb 24, 2014, in forum: Perl Misc
    Replies:
    152
    Views:
    612
    $Bill
    Mar 11, 2014
  2. Kaz Kylheku

    Re: use strict; use warnings;

    Kaz Kylheku, Feb 24, 2014, in forum: Perl Misc
    Replies:
    0
    Views:
    81
    Kaz Kylheku
    Feb 24, 2014
  3. Mart van de Wege

    Re: use strict; use warnings;

    Mart van de Wege, Feb 24, 2014, in forum: Perl Misc
    Replies:
    1
    Views:
    73
    Mart van de Wege
    Feb 25, 2014
  4. Justin C

    Re: use strict; use warnings;

    Justin C, Feb 24, 2014, in forum: Perl Misc
    Replies:
    2
    Views:
    100
    Justin C
    Feb 25, 2014
  5. Janek Schleicher

    Re: use strict; use warnings;

    Janek Schleicher, Feb 24, 2014, in forum: Perl Misc
    Replies:
    4
    Views:
    102
    $Bill
    Feb 25, 2014
Loading...

Share This Page