I will agree with the assessment that some Perl scripts are indeed trivial enough to not be concerned with globals - but not 23 globals! ;)

I think that the stucture of this script is excellent! Adding command line argument support should be a breeze now (hint! hint!). However, i would change the name of the subroutine Main to something more descriptive like fetch_message or just fetch. (and lower case is nicer!)

Off topic, i advise against re-using variables like you do with this snippet:

my $url = "ftp://$id:$pw\@$dom/logs/"; $url = new URI::URL("$url/$logweb");
Taken out of context like that, you hopefully see that this really is not good. It was a string, now it's an object - this is the kind of practice that results in hard to track bugs. Better to just be safe and decouple:
my $site = "ftp://$id:$pw\@$dom/logs"; my $url = new URI::URL("$site/$logweb");
Also (and i say this because i have been corrected on this as well), if a subroutine returns a value, return the value:
sub Yesterday { # sidetrack: following golf just a thought ... my($yy, $ym, $yd) = Add_Delta_Days(Today(), -1); return sprintf "%04d-%02d-%02d", $yy, $ym, $yd; }
And this doesn't just go for this subroutine, adding returns to your Main function is highly recommended. Sure Perl evaluates the last expression and returns it, but saying that with an explicit return says a lot more to others trying to understand the script (especially if they are Perl newbies coming from another language).

Other than those nit-picks, i say nice work ybiC...

UPDATE
...but also heed chromatic's wisdom!

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

In reply to (jeffa) Re: Is this a good approach for reducing number of global variables? by jeffa
in thread Is this a good approach for reducing number of global variables? by ybiC

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.