>>>>> "PS" == Peter Scott <[EMAIL PROTECTED]> writes:

  PS> Here's a distillation of something that just bit me, behaves the same on
  PS> 5.6.1 and 5.8.5.  Observe the following program:

  PS> for (1..2) {
  PS>   print_file($0);
  PS> }

  PS> for (qw(one two)) {
  PS>   print_file($0);
  PS> }

  PS> sub print_file {
  PS>   local @ARGV = shift;
  PS>   while (<>) { print }
  PS> }

  PS> __END__

  PS> Before running it, can you tell:
  PS>   Will it succeed or not?
  PS>   If not, with what error?
  PS>   Where?
  PS>   Why?

i haven't run it but i already see conflicts with nested $_. the
while(<>) will use $_ and so do the for loops. i wouldn't hazard a guess
as to what the code will do. i never run into that since i rarely use
$_. i use my vars on all loops and only use $_ where required
(map/grep/for modifier) or in one liners and such.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to