Jas <[EMAIL PROTECTED]> wrote:
:
: Wc -Sx- Jones wrote:
:
: > In Cyberspace -- Jas wrote:
: >
: > > # Create empty variables
: > > my $year = "";
: > > my $month = "";
: > > my $day = "";
: > > my $c_year = "";
: > > my $c_month = "";
: > > my $c_day = "";
: >
: > Less wordy...
: >
: > my ( $year,
: > $month,
: > $day,
: > $c_year,
: > $c_month,
: > $c_day ) = '';
: >
: Awesome, I will use this on future scripts.
It doesn't do the same thing. You would need:
my ( $year,
$month,
$day,
$c_year,
$c_month,
$c_day ) = ('') x 6;
Though we only need one of them for this algorithm
(untested):
# Current date stamp
my $date = strftime '%Y%m%d', localtime $^T;
.
.
.
# Check for matching files not from this month
my $this_month = strftime '%m', localtime $^T;
my @list;
foreach my $file ( $ftp->ls ) {
unless ( $file =~ /^\d{4}(\d{2})\d{2}-www\.t(?:ar\.)?gz$/i ) {
warn "Skipping improper file format: $file";
next;
}
unless ( $1 != $this_month ) {
warn "Skipping recent file: $file";
next;
}
push @list, $file;
}
$^T is the time the script started. By using it for a time
stamp, instead of time(), we don't have to jump through hoops to
find the month and we have a constant time stamp in an easy to
use format.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>