[Israel.pm] setting $!

Yosef Meller mellerf at netvision.net.il
Sun Jul 18 13:53:29 PDT 2004

Shlomo Yona wrote:
 > Hello,
 > I have a function foo() which returns some scalar $s.
 > I'd like to be able to do something like this:
 > 	my $s = foo() or die "foo: $!";
 > I'd like to  be able to assign my own string to $! to be
 > used right after a return from foo()  in case an undefined
 > value is returned.
 > What's the way to do this?

perlvar says you can assign a numerical errno value to it. But whyu not
use Error.pm or something similar? Or use the common method of setting
$PKG::errstr and returning undef? Just curious.

   "No, I do not contain myself,"
   were the final words from the set of self-excluding sets. :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://perl.org.il/pipermail/perl/attachments/20040718/4b580f5c/attachment.pgp 

More information about the Perl mailing list