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

In reply to Re: A podcatcher in Perl by jwkrahn
in thread A podcatcher in Perl by jimhenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.