Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: "map" sometimes uses only the last mapped value

by bobf (Monsignor)
on Apr 18, 2006 at 04:06 UTC ( [id://543995]=note: print w/replies, xml ) Need Help??


in reply to "map" sometimes uses only the last mapped value

I get different results depending on whether or not $f is quoted in the for list:

sub f2a { my ($f) = @_; for my $d ("$f") {return $d} } sub f2b { my ($f) = @_; for my $d ($f) {return $d} } print map {f2a($_)} qw(x y z); # zzz print map {f2b($_)} qw(x y z); # xyz

I also ran it through B::Deparse, but gained no insight.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found