Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^6: how to deal with incorrect command line argument

by marinersk (Priest)
on Oct 31, 2013 at 21:28 UTC ( #1060645=note: print w/replies, xml ) Need Help??


in reply to Re^5: how to deal with incorrect command line argument
in thread how to deal with incorrect command line argument

So very well done.

Does this qualify for a FAQ or something?

  • Comment on Re^6: how to deal with incorrect command line argument

Replies are listed 'Best First'.
Re^7: how to deal with incorrect command line argument
by muba (Priest) on Oct 31, 2013 at 21:40 UTC

    Nah, barely. The line of code just shows what Perl is good at: using minimalist building blocks, combining into something actually meaningful.

    In itself, the ternary operator ?: is not so surprising. It makes its appearance in many languages, such as C, C++, C# (I believe), Obj-C (I believe), Java (I believe), JavaScript, and likely many more.

    Statement modifiers also aren't very mention-worthy, in that many languages in the C-family allow you to

    if (THIS) THAT;

    Whereas Perl requires the curly braces around it:

    if (THIS) { THAT; }

    But not if you write it as

    THAT if THIS;

    So statement modifiers are just one of those things in Perl's syntax that make Perl Perl, however it's not something we don't know in one form or another from other languages.

      Yeah, I remember the ternary if from C; didn't use it very much. I'd rather write code that a new developer can read slightly more englishly, and the braces, newlines, and indentation give a fair bit of intuition to where the code is going.

      I know I carry a lot of that prejudice into my Perl, but I rarely get complaints about my Perl being unreadable (only my variable names, which I staunchly continue to lay out in my peculiar 3x2 format -- but the code itself almost never gets complaints).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2019-06-24 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (99 votes). Check out past polls.

    Notices?