in reply to Extracting date encodings from a filename... is my regex-based function correct?
My guess is that you have a two digit year, followed by a two digit month and a two digit day, but I'm not sure about the rest of the numbers or whether or not the letters (such as nasd) will change. If you wish, you can build that date substring by using localtime. This will simplify the regex.
This assumes that you always need files with todays date stamp. You'll need to modify it to fit your particular needs.my ($day, $month, $year) = (split (/\s|:/, localtime))[2,3,6]; $year = substr $year, 2,2; my $date = $year . $month . $day;
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just go the the link and check out our stats.
|
|---|