in reply to replacing say function

sub say { local $\ = "\n"; print @_ ? @_ : $_; }
That will not work if you ever use a file handle as the first argument (without comma), though.

And, uh... there's also Perl6::Say

Replies are listed 'Best First'.
Re^2: replacing say function
by d5e5 (Beadle) on Feb 11, 2011 at 21:54 UTC

    I like bart's (edited to correct name) solution except you may want to add a prototype so you can call the sub without parentheses around the arguments.

    #!/usr/bin/perl use strict; use warnings; use 5.008; sub say (@){ local $\ = "\n"; print @_ ? @_ : $_; } say 'Hey';
    >>>Update>>>: On further testing, I guess you don't need a prototype. The trick is to define the sub above the statement where you call it. The following works just as well for me:
    #!/usr/bin/perl use strict; use warnings; use 5.008; sub say{ local $\ = "\n"; print @_ ? @_ : $_; } say 'Hey';
      You don't need a prototype for that. All you need to do is to define the sub before you call it — or put it in a module that you use. Same thing.
      Sweet! Thanks, all done now :)
Re^2: replacing say function
by JavaFan (Canon) on Feb 11, 2011 at 21:55 UTC
    And it won't work for a say without arguments when a lexical $_ is in effect. But your say will work in 99.5% of the cases.
      Since lexical $_ was new in Perl 5.10, I don't think there is a problem with that.
        And so was say, which turns out to be a "problem" for the OP. I don't think it will be an issue for the OP - and if it occurs in his program, it's something he needs to fix separately anyway. And the compiler will tell him where the program uses a lexical $_.