in reply to Re: Stuck in Perl.. Partial code, but it needs more improvement.. Any suggestions, please?
in thread Stuck in Perl.. Partial code, but it needs more improvement.. Any suggestions, please?
The typical idiom for this is,
open (my $fh, $mode, $file) || die $!;
This also mitigates the need for an -e check for read $mode that expect $file exist, particularly useful inside of an eval block or Try::Tiny construct; so that you can handle it.
Update, fixed precedence. Point remains the same.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Stuck in Perl.. Partial code, but it needs more improvement.. Any suggestions, please?
by 1nickt (Canon) on Jun 03, 2021 at 00:06 UTC | |
by perlfan (Parson) on Jun 04, 2021 at 00:43 UTC | |
by LanX (Saint) on Jun 04, 2021 at 12:30 UTC | |
by hippo (Archbishop) on Jun 04, 2021 at 12:44 UTC |