Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Unexpected behavior with "map"

by fishmonger (Pilgrim)
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' ];


Comment on Re: Unexpected behavior with "map"
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (18)
As of 2014-12-19 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (90 votes), past polls