in reply to Re^2: Reliably simulating 5.10 say()
in thread Reliably simulating 5.10 say()

It works perfectly for me. Please show the exact code that you tested and gave this error.

Je suis Charlie.

Replies are listed 'Best First'.
Re^4: Reliably simulating 5.10 say()
by hlc (Initiate) on Feb 08, 2015 at 15:15 UTC
    #!/usr/bin/env perl + + use strict; + use warnings; + + sub say (_) { + print @_, "\n"; } + + my @a = qw(1 2 3); + + # using implicit $_ does not work: + say foreach (@a); + + # ...and of course explicit $_ works. + say $_ foreach (@a); + + # works: + say "uncle bob";
    The error for above:
    Illegal character in prototype for main::say : _ at a.pl line 6. Not enough arguments for main::say at a.pl line 13, near "say foreach +" Malformed prototype for main::say: _ at a.pl line 16.