Problems? Is your data what you think it is? | |
PerlMonks |
Need Help in Understanding Some Code - Map and Scalar Questionsby Dru (Hermit) |
on Oct 30, 2010 at 18:27 UTC ( [id://868491]=perlquestion: print w/replies, xml ) | Need Help?? |
Dru has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I am trying to enlighten myself by reading as much code on here as possible and figuring out the parts that I do not understand. I came across this post Networking Perl today and Your Mother's reply had the following code There are two items in this that are giving me trouble. First this map, I don't quite understand what it is doing (it seems no matter how much I read about map I still can't quite grasp it): Is it saying "For each item found in $req->path that is a number save it as a hash key of %pids?" The other thing that confuses me is this I know "scalar(%pids)" will force the hash %pids to be interpreted in scalar context, but to be honest with you I do not know exactly what this will do to the hash. I tried testing this on my own with the following code: But this prints out "3/8" so I'm really confused. Thank you for helping me on my journey. Thanks, Dru Perl, the Leatherman of Programming languages. - qazwart
Back to
Seekers of Perl Wisdom
|
|