From: WC -Sx- Jones <[EMAIL PROTECTED]>
> Jenda?
> 
> This is the partial original post -
> 
> Jas wrote:
> > Wouldn't this be better?
> > 
> > my $year = "";
> > my $month = "";
> > my $day = "";
> > 
> > if($file =~ /^(\d{4})(\d{2})(\d{2})-www.tar.gz$/) {
> >   $year = $1;
> >   $month = $2;
> >   $day = $3;
> > 
> > my $chk = "$month - 1";
> 
> Here - this is weird =)
> 
> "03" in numerical context is 3.
> 
> File name was 20040301 - collapses to 200431 -
> Not a match IMHO.

I see. You did not include that line in the email I was responding 
to. So I did not see anything that could provide numerical context.

        my $chk = "$month - 1";
is simply wrong. If $month was '03' then $chk will be '03 - 1'.
And if it was 
        my $chk = $month - 1;
then $chk would be 2. Which is much better, but needs to be handled 
properly.

If Jas wanted a date one month before now he'd need something like:

        $month--;
        if ($month == 0) {
                $month = 12;
                $year--;
        }
        $datestamp = sprintf "%04d%02d%02d", $year, $month, $day

> > foreach($file ! $chk) {

This line is a clear syntax error.

> Maybe I am totally confused - I have been working on WebSphere.  Yes,
> I plead complete insanity.

No I guess it's me who's confused. I am stateless. I handle each 
email separately, not remembering anything from the previous ones. 
(Well almost.) I do not keep the old ones and with the amount of spam 
and viruses I get looking up something in the "Deleted" folder is 
rather hard.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to