Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Unexpected behavior with "map"

by fishmonger (Chaplain)
on Mar 12, 2014 at 19:12 UTC ( #1078075=note: print w/replies, xml ) Need Help??


in reply to Unexpected behavior with "map"

Have you considered using a module designed for parsing paths?

use File::Basename; use Data::Dumper; my @oldlist = qw X /etc/passwd /etc/group /egg/drop /etc/shadow X; my @newlist = map {basename $_} @oldlist; print Dumper \@newlist;

outputs:

$VAR1 = [ 'passwd', 'group', 'drop', 'shadow' ];

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078075]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-07-20 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (316 votes). Check out past polls.