Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: while(<>) { ... } considered harmful

by Aristotle (Chancellor)
on Sep 08, 2002 at 05:15 UTC ( #195983=note: print w/ replies, xml ) Need Help??

in reply to Re: while(<>) { ... } considered harmful
in thread while(<>) { ... } considered harmful

Because something like my @idx = map /(id\d+)/, @items;
is a lot more natural than

my @idx; /(id\d+)/ && push @idx, $1 for @items;
(which is already pushing legibility). Basically when you build one list out of another, non-destructively, map is the ticket. It can be in other cases as well, but those can often go either way.

Makeshifts last the longest.

Comment on Re^2: while(<>) { ... } considered harmful
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2015-11-29 12:28 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (750 votes), past polls