Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Syntactic Confectionery Delight
 
PerlMonks  

Re: For Loops and Reversing output

by Limbic~Region (Chancellor)
on Dec 12, 2006 at 00:36 UTC ( #589199=note: print w/ replies, xml ) Need Help??


in reply to For Loops and Reversing output

brusimm,
So you want to reverse without using reverse:

my $idx = $#array; while ($idx--) { print "$array[$idx]\n"; }
Oh, you really want to go forwards but have the output appear backwards?
my $output = ''; for my $elem (@array) { $output = "$elem\n" . $output; } $output .= "\n"; print $output;

Cheers - L~R


Comment on Re: For Loops and Reversing output
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://589199]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-04-21 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (490 votes), past polls