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?