develooper Front page | perl.fwp | Postings from September 2006

Error puzzler

Thread Next
From:
Peter Scott
Date:
September 13, 2006 11:06
Subject:
Error puzzler
Message ID:
pan.2006.09.13.16.20.18.654468@PSDT.com
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/


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About