Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Handling multiple output files simultaneously using arrays of filehandles and filenames

by Fletch (Chancellor)
on Jan 21, 2021 at 20:29 UTC ( #11127230=note: print w/replies, xml ) Need Help??


in reply to Re^2: Handling multiple output files simultaneously using arrays of filehandles and filenames
in thread Handling multiple output files simultaneously using arrays of filehandles and filenames

You need $! because otherwise you only know that there's been an error of some sort and not what specific error occurred. Just grobbling through the open(2) manual page on OS X there's 22 distinct error codes in 32 different cases which can be returned at the C level.

The trailing newline is mostly an aesthetic choice though.

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re^3: Handling multiple output files simultaneously using arrays of filehandles and filenames
  • Download Code

Replies are listed 'Best First'.
Re^4: Handling multiple output files simultaneously using arrays of filehandles and filenames
by bliako (Prior) on Jan 21, 2021 at 20:57 UTC

    nitpick:

     The trailing newline is mostly an aesthetic choice though. 

    I learned here at the Monastery (sorry can't remember by whom) that calling die with a final newline will cause it to omit the line number. It will be less verbose.

    die "aaa"; aaa at - line 1. die "aaa\n"; aaa
      Thanks. That's interesting!

        keep it up Cosmic37!

Re^4: Handling multiple output files simultaneously using arrays of filehandles and filenames
by Cosmic37 (Acolyte) on Jan 21, 2021 at 21:04 UTC
    Thanks for this opinion. I think its good advice and good practice in most cases but that there may be cases when a programmer chooses to do something different, believing (almost insisting) themselves to be a free person living in a free world (I know; how naive). I am very grateful for your engagement, and all those who have offered advice and opinion in response to my question.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2021-04-17 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?