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

Re: For Loops and Reversing output

by Limbic~Region (Chancellor)
on Dec 12, 2006 at 00:36 UTC ( [id://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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-19 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found