1: sub newopen { 2: my $path = shift; 3: local *FH; # not my! 4: open (FH, $path) or return undef; 5: return *FH; 6: } 7: $fh = newopen('/etc/passwd');
I believe the idea was that a FH may already exist in the same scope as line 7. If we do a open FH, ... the old FH will get over written. By declaring FH to be local, that sub can not change the outer FH. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/