Your code will not work if $_ is lexical.You can't make $_ a lexical:
$ perl -lwe "my $_='abc'; chop; print" Can't use global $_ in "my" at -e line 1, near "my $_" Execution of -e aborted due to compilation errors.
In reply to Re^2: How can I avoid code repetition here
by rovf
in thread How can I avoid code repetition here
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |