Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Map not giving me what I thought it would.

by damian1301 (Curate)
on Jun 02, 2001 at 08:54 UTC ( #85159=note: print w/ replies, xml ) Need Help??


in reply to Map not giving me what I thought it would.

As the above two mentioned, it is because of the substitution's return value. So, instead of using your way of joining the values, you can just put the whole thing one map with the same functionality and without the extra newline.

my @array = map {s/^-//;$_.="\n"}@ARGV;

Simple stuff, basically just does what you were doing then uses the "$var = $var.stuff" operator (which I love dearly =) to append a newline onto the end of each line.

$TMTOWTDI++;

Tiptoeing up to a Perl hacker.
Dave AKA damian


Comment on Re: Map not giving me what I thought it would.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-30 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls