in reply to A podcatcher in Perl

454 # ===== basic utility routines 455 456 sub writelog; 640 sub writelog($) { 641 my $arg = shift;

Your forward declaration of writelog does not include a prototype and therefore the effects of the prototype do not apply until after it is declared.

No prototype:

$ perl -le' use warnings; use strict; my @x = 14 .. 19; sub writelog; writelog @x; writelog "F" .. "J"; sub writelog ($) { my $arg = shift; print "\@_ = @_\t\t\$arg = $arg"; } writelog @x; writelog "F" .. "J"; ' Useless use of range (or flop) in void context at -e line 13. @_ = 15 16 17 18 19 $arg = 14 @_ = G H I J $arg = F @_ = $arg = 6 @_ = $arg = F Argument "J" isn't numeric in range (or flop) at -e line 13. Use of uninitialized value $. in range (or flop) at -e line 13.

With Prototype:

$ perl -le' use warnings; use strict; my @x = 14 .. 19; sub writelog ($); writelog @x; writelog "F" .. "J"; sub writelog ($) { my $arg = shift; print "\@_ = @_\t\t\$arg = $arg"; } writelog @x; writelog "F" .. "J"; ' Useless use of range (or flop) in void context at -e line 7. Useless use of range (or flop) in void context at -e line 13. @_ = $arg = 6 @_ = $arg = F Argument "J" isn't numeric in range (or flop) at -e line 7. Use of uninitialized value $. in range (or flop) at -e line 7. @_ = $arg = 6 @_ = $arg = F Argument "J" isn't numeric in range (or flop) at -e line 13. Use of uninitialized value $. in range (or flop) at -e line 13.
Naked blocks are fun! -- Randal L. Schwartz, Perl hacker