http://www.perlmonks.org?node_id=985761


in reply to through an array in reverse

Backwards in an array? Simple...

use strict; my @j=qw/ a b c d e f g /; while ( my $i=pop @j){ printf "%s\n",$i; }


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: through an array in reverse
by Athanasius (Archbishop) on Aug 06, 2012 at 16:38 UTC

    OK, but let’s not forget the reverse function:

    #! perl use strict; use warnings; my @j = ('a' .. 'g'); print join("\n", reverse @j);

    ;-)

    Athanasius <°(((><contra mundum

          but let’s not forget the reverse function

      TIMTOWTDI exemplified!


      Peter L. Berghold -- Unix Professional
      Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg