P
Peter Michael
Hi,
what is currently the preferred way to distinguish between different
values of $! ? I suppose that %! was created to this end (sample code?)
but should I use Switch(3) instead today?
use Errno qw
POSIX);
use Switch;
open my $fh, "file" or do
{ switch($!)
{ case ENOENT { warn "you should first create the file\n"; }
case EACCES { warn "you are not allowed to see this\n"; }
else { warn "some other error...\n"; }
}
};
Any hints welcome (Anno? ;-).
Best regards,
Peter
what is currently the preferred way to distinguish between different
values of $! ? I suppose that %! was created to this end (sample code?)
but should I use Switch(3) instead today?
use Errno qw
use Switch;
open my $fh, "file" or do
{ switch($!)
{ case ENOENT { warn "you should first create the file\n"; }
case EACCES { warn "you are not allowed to see this\n"; }
else { warn "some other error...\n"; }
}
};
Any hints welcome (Anno? ;-).
Best regards,
Peter