I think as long as a failed open() or mkdir() (IE a system function that
does $! sets it already) then that is all I need for this project:
sub baz {
mkdir '/dir/I/cant/make' or return;
}
will do what i need:
baz or die $!;
Actually mkdir returns true or false -
sub baz{return mkdir '/dir/I/cant/make';}
would do the same without any evaluation.
good point!
$ cat baz.pl
#!/usr/bin/perl
use strict;
use warnings;
baz() or die $!;
sub baz {
mkdir 'faz/shaz/waz/daz';
}
$ perl baz.pl
No such file or directory at baz.pl line 5.
$
Although I'd need to 'or return' if it wasn't last thing in the block
$ cat baz.pl
#!/usr/bin/perl
use strict;
use warnings;
baz() or die $!;
sub baz {
mkdir 'faz/shaz/waz/daz';
return 1;
}
$ perl baz.pl
$
$ cat baz.pl
#!/usr/bin/perl
use strict;
use warnings;
baz() or die $!;
sub baz {
mkdir 'faz/shaz/waz/daz' or return;
return 1;
}
$ perl baz.pl
No such file or directory at baz.pl line 5.
$
Thanks!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>