Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Why should I use perl 5.10?

by moritz (Cardinal)
on Nov 30, 2007 at 10:09 UTC ( [id://654076]=note: print w/replies, xml ) Need Help??


in reply to Why should I use perl 5.10?

Well, it has the say builtin. And say $foo; is so much shorter and sweeter than print $foo, "\n";.

Admitted, doesn't sound really great, but try it! After writing a few scripts in Perl 6 I wouldn't want to miss it.

Replies are listed 'Best First'.
Re^2: Why should I use perl 5.10?
by mwah (Hermit) on Nov 30, 2007 at 10:20 UTC
    Well, it has the say builtin.

    and

    Admitted, doesn't sound really great,

    this is exactly my opinion too, say() doesn't say anything about its use ;-)

    Wouldn't even println() have been a better naming choice? (BYMMV) ;-)

    ... { local $\ = "\n"; ... ... print $foo; ... }

    Regards

    mwa

      Wouldn't even println() have been a better naming choice?

      Surely not!

      Perl builtins tend to be one word that can (syntactically) be read as plain English, with a few exceptions that come from POSIX system calls (like gethostbyname)

      And println is too long, compared to say ;-)

      The word say suggests some I/O similar to print, which in fact it is. The exact semantics are not obvious, but they aren't hard to learn.

        And println is too long, compared to say ;-)

        I personally believe that this is serious enough not to warrant a ;-) since the keyword is huffmanization. IME I tend to print ... "\n" just as often or more than in "\n"-less form so in oneliners and minimal example scripts I tend to use -l quite a lot. But that is bad and risky in that as sometimes it pops up, it can interact with modules that do actual prints. And module authors probably should not be concerned with setting local $\ accordingly. So for all these reasons and for the others that have been said here thus far, however simple it is say() is welcome, and a blessing!

      I don't understand why we didn't just use puts(). NIH?

        That's easy: because puts is a stupid name. Why continue the confusion that C has already creatd?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found