Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: What technical benfits perl offers over python + few more questions.

by Fletch (Bishop)
on Nov 15, 2021 at 17:36 UTC ( [id://11138843]=note: print w/replies, xml ) Need Help??


in reply to Re^4: What technical benfits perl offers over python + few more questions.
in thread What technical benfits perl offers over python + few more questions.

I think the distinction being made is maybe that in (say) Java trying to print on a closed filehandle object would throw an IOException which your code would be required to handle, whereas perl  -E 'close(STDOUT);say qq{FOOP}' will run (producing no output but also not printing any sort of error (although you could check the return from say and print $!)).

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

Replies are listed 'Best First'.
Re^6: What technical benfits perl offers over python + few more questions.
by Marshall (Canon) on Nov 15, 2021 at 21:17 UTC
    Of course if you "use warnings;", you will see the "print() on closed filehandle STDOUT" warning.
      > Of course if you "use warnings;", you will see the "print() on closed filehandle STDOUT" warning.

      and ...

      Of course you can propagate warnings to die by changing $SIG{__WARN__} ;-)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

Re^6: What technical benfits perl offers over python + few more questions.
by LanX (Saint) on Nov 15, 2021 at 21:59 UTC
      I see what you mean. I am just starting with Python. Instead of handling the exception, it appears that:
      for value in some_iterable: print(value)
      is the preferred syntax.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-24 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found