in reply to Parsing a date from comma-delimited file

If the format of the dates in your text file are consistant, there may be no need to parse the dates in it...

use warnings; use strict; use Date::EzDate; #Date::EzDate can parse several date formats w/o intervention, #so let's make life easy for end-users by making the input format #flexible. my $date_in = 'Mar 13, 04'; my $date = Date::EzDate->new($date_in) or die "Couldn't parse the date '$date_in'.\n"; #convert the date to a string that will match the consistent format #in our DATA file. Note that this will only work if the date format #in the file is, in fact, consistent. my $match_date = $date->{'%f/%h/%Y'}; print "Looking for matches on $match_date:\n"; while (<DATA>) { #a regex match might work as well as splitting #note that there is no need to split the date since we're just #matching strings print if $match_date eq (split)[2]; } 1; __DATA__ blah blah 1/Feb/2004 Gamera blah blah 13/Mar/2004 Godzilla blah blah 22/Jan/2004 Mothra blah blah 3/Apr/2004 Baragon blah blah 13/Feb/2004 Guiron blah blah 5/Feb/2004 King Ghidorah blah blah 27/Mar/2004 Legion blah blah 13/Mar/2004 Mechagodzilla
Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"