Error puzzler

Peter Scott <[email protected]> Wed, 13 Sep 2006 09:20:19 -0700
Newsgroups gmane.comp.lang.perl.fun
Organization Pacific Systems Design Technologies
Message-ID <[email protected]>
Here's a distillation of something that just bit me, behaves the same on
5.6.1 and 5.8.5.  Observe the following program:

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

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

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

__END__

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

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/