Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: "open" Best Practices

by Discipulus (Canon)
on Jul 12, 2019 at 07:33 UTC ( [id://11102715]=note: print w/replies, xml ) Need Help??


in reply to "open" Best Practices

Thanks haukex for this, I vote for you and hippo as new perlmonks tutorial organiser ;) I confused haukex and hippo.. both are anyway worth to thanks ;)

> It is best to also report the filename as well, and of course you're free to customize the message as needed.

About this I almost always use the filename within square brackets or single quotes, to avoid nasty empty space problems (even if your use, with filename as first element and followed by : can spot these problems too). I also spend more words in errors, just in case:

open my $fh, '<', $filename or die "Unable to open [$filename] becaus +e of: $!";

Also, being on unfortunate OS , sometimes I add $^E aka $EXTENDED_OS_ERROR ( under MSWIN32 $^E can be different from $! ):

open my $fh, '<', $filename or die "Unable to open [$filename] becaus +e of: $! $^E";

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11102715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found