>>>>> "jiqiang" == jiqiang yao < jiqiang123%40yahoo.com">jiqiang123
yahoo.com> writes:
jiqiang> I want to write a subroutine for openfile (see below).
jiqiang> However, the subroutine failed to be returned to
jiqiang> $fhandle. Can anybody tells me why?
Yes, stop using package-based filehandles. Use lexical filehandles.
sub openfile {
open my $handle, "<", shift or die "Cannot open: $!";
return $handle;
}
But if it's this short, I wouldn't even write a subroutine.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
< merlyn%40stonehenge.com">merlyn
stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
.