Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
1: Naked blocks. You can use naked blocks for quite a number of purposes. They can be used to scope (lexical/my) variables, which is what I normaly use them for. You can also use the loop control operators (next,redo,last...) on them, and build your own loop that operates exactly how /you/ want it to. 2: I can think of several reasons. One is using a m// where an eq would do -- regexes are /expensive/. Also, interpolating a variable into a regex will use the regex metachars in the interpolated variable as such, which is normaly not what you want. 3: next takes you directly to the next iteration of the loop. You can call it only once per iteration (obviously), but as many places as you want.... for example: will keep printing "a" over and over, and never get to the second next. It's still perfectly valid code... just not very useful. Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node). In reply to Re: A few random questions from Learning Perl 3
by theorbtwo
|
|