in reply to Re^4: return undef
in thread return undef
Both are possible; it all depends what you want to do. Here's a function that returns an open read handle:
sub rh { my $filename = shift; open my $in, '<', $filename or die "Couldn't open $filename for reading: $!\n"; return $in; } my $in = rh( 'somefile.txt' ); print while <$in>;
If your myfunction returns the contents of a file, then see ysth's reply.
the lowliest monk
|
|---|