Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: improve script

by afoken (Chancellor)
on Nov 28, 2015 at 16:53 UTC ( [id://1148766]=note: print w/replies, xml ) Need Help??


in reply to Re^3: improve script
in thread improve script

if ( somecondition ) { print "..."; exit; }

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^5: improve script
by BrowserUk (Patriarch) on Nov 28, 2015 at 21:11 UTC

    Or just:

    print( "$1\n" ), exit if /.../;

    Or even:

    die "$!\n" if /.../;

    Which seems to capture the semantics perfectly.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.
      > Which seems to capture the semantics perfectly.

      Yes, except it's printing to STDERR not STDOUT.

      That's complicating things if sh has to capture the output.

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        Yes, except it's printing to STDERR not STDOUT.

        Far more than you ever wanted to know about shell redirections

        That's complicating things if sh has to capture the output.

        No, only that way allows to cleanly separate usable data (STDOUT) from error messages (STDERR), without having to use heuristics (in other words: automated guessing).

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^5: improve script
by choroba (Cardinal) on Nov 28, 2015 at 18:58 UTC
    It wouldn't print anything if STDOUT was closed, though.
    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-19 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found