Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl ranges

by RMGir (Prior)
on May 06, 2013 at 11:46 UTC ( [id://1032260]=note: print w/replies, xml ) Need Help??


in reply to Perl ranges

TMTOWTDI :)

But the easiest would seem to me to be a regular expression (assuming you mean files from the 21st to the 31st in the $time_string field?):

if ($time_string =~ /\d\d\d\d-\d\d-(\d\d)/ && ($1>=21 && $1<=31)) +{ print "File $name has an mtime of $time_string\n"; $ftp->get($name) or die "get failed ", $ftp->message; }

Mike

Replies are listed 'Best First'.
Re^2: Perl ranges
by merlin's apprentice (Novice) on May 06, 2013 at 13:13 UTC

    Thanks Mike! Let me try that and get back to you with my findings...

      Hi Mike, I tried that this way:

      my $time_string = strftime "%Y-%m-%d", gmtime($mtime); if ($time_string =~ 2013-04-01 && ($1>=01 && $1<=20)) { print "File $name has an mtime of $time_string\n"; $ftp->get($name) or die "get failed ", $ftp->message;

      And it still didn't work for me. You see, what I'd like for it to do is change the day only incrementally from the 1st of the month to the 20th of the month (as in the example above) Is there any way I could do that using your code?

Re^2: Perl ranges
by merlin's apprentice (Novice) on May 06, 2013 at 13:56 UTC

    Hi Mike,

    I've tried it this way:

    if ($time_string =~ /\2013-\04-(\01)/ && ($1>=01 && $1<=20)) { print "File $name has an mtime of $time_string\n"; $ftp->get($name) or die "get failed ", $ftp->message;

    It hasn't brought any results -just returned the prompt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1032260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-19 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found