Hello hlc, and welcome to the Monastery!
This is one case where prototypes are actually useful. From perlsub#Prototypes:
As the last character of a prototype, or just before a semicolon, a @ or a %, you can use _ in place of $: if this argument is not provided, $_ will be used instead.
Hence:
#! perl use strict; use warnings; sub say (_) # <-- ADD THIS { print @_, "\n"; } my @a = qw(1 2 3); say for @a;
Output:
0:16 >perl 1151_SoPW.pl 1 2 3 0:16 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Reliably simulating 5.10 say()
by Athanasius
in thread Reliably simulating 5.10 say()
by hlc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |