Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: For Loops and Reversing output

by GrandFather (Sage)
on Dec 12, 2006 at 00:40 UTC ( #589200=note: print w/ replies, xml ) Need Help??

in reply to For Loops and Reversing output

Something like this maybe?

use strict; use warnings; my $input = 'somelist'; # Original Line my @unsorted = qw(big small knobly broken round green); my @sorted = sort @unsorted; my @rocks; for (@sorted) { unshift @rocks, $_; print "$_\n" } print "\n"; print "The names, backwards, are:\n\t", join "\n\t", @rocks;


big broken green knobly round small The names, backwards, are: small round knobly green broken big

DWIM is Perl's answer to Gödel

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2015-08-31 14:43 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (358 votes), past polls