zer has asked for the wisdom of the Perl Monks concerning the following question:
Good morning,
I have come across some interesting questions from some friends on the use of comma's within the perl language. It appears that arguments for all subroutines are comma delimited. However when you come accross map/grep it changes
The proper formating is for blocks to be without a comma. Then with non-blocked items it would return to the comma. Another example is with the print statement.map {/dothis/} @variable; grep {/more stuff/} @more;
So in this portion you are sending a file handle and it doesnt accept a comma. If you were to use seek it would be comma seperated. Which makes me ask...open (A, ">File") or die; print A "hello"; print $somevar, "can be seperated like this";
- Why are the comma's excluded in some spots and not others?
- How does this work with your own prototypes and subroutines?
- Which perldoc covers this in depth?
Back to
Seekers of Perl Wisdom