Do you know where your variables are? | |
PerlMonks |
How does this code work? (from "Perl is Unix")by Anonymous Monk |
on Nov 06, 2009 at 05:22 UTC ( [id://805392]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: Here at plasmasturm I see the following little sub:
Formatting that out a bit, it's:
So, I suppose it's stripping whitespace off of every element in @_. I see what the regexen are doing, but how is that "for" loop working? With the equals sign there ... I just don't get it. Regarding the comma, I suppose it's just a separator that tells perl to just evaluate one s/// after the other. Further down in the code, there's this "for" loop:
Are run_fork and child function calls? They look strange to me. The only place I think I've ever seen functions that take a block of code after them is with map and grep... How does one write a sub that takes a block of code (in curlies) like that? Actually, I've used {}'s to make hash refs for passing a handful of named params to a sub, but I don't think that's what's going on here...
Back to
Seekers of Perl Wisdom
|
|