in reply to Is this a good approach for reducing number of global variables?

Very nice, you've got them all scoped as lexicals. None of the following is criticism, you've chosen a style which is very good for maintainance.

There are a few things you could do to limit scopes further. The simplest and least obtrusive would be a bare block around my $yesterday' and my @msg; like this:

use LWP::UserAgent; { print "\n Fetching log...\n\n"; my $yesterday = Yesterday(); my @msg = Main( 'joe@modem.com', # remote domain 'yosef', # remote id 'secret', # remote password "access.log.$yesterday", # remote logfile input 'c:/logs', # local dir to write to 'access.log', # local logfile output ); print "$_\n" for(@msg); }
I included the initial print statement in the block, just in case you want to localize $\ and kin.

My own inclination is to do away with named variables as much as is consistent with maintainability and readability, so I might have written that as:

{ local $\="\n"; print "\n Fetching log...\n"; print for Main( 'joe@modem.com', # remote domain 'yosef', # remote id 'secret', # remote password "access.log.".Yesterday(), # remote logfile input 'c:/logs', # local dir to write to 'access.log', # local logfile output ); }
but that is less useful for debugging. Its readability is a matter of what one's used to. Similarly, I might write Yesterday() as:
sub Yesterday { sprintf "%04d-%02d-%02d", Add_Delta_Days(Today(),-1); }
If you want to really gild the lily, you could define a private namespace for your sub names: package myscript; sub Main{} sub Yesterday {} package main;. That would be really fussy though ;-)

After Compline,
Zaxo