[Omaha.pm] next can jump out of a sub?

Jay Hannah jhannah at omnihotels.com
Thu Dec 23 12:46:55 CST 2004


Wow. What do you suppose this prints?

I thought it would (1) syntax error (next without loop) or (2) print 1 and then exit. 

I was wrong...

j


for (1..5) {
   print "$_\n";
   x();
   exit;
}

sub x {
   next;
}





More information about the Omaha-pm mailing list