in reply to Parsing a date from comma-delimited file

@lineData = split(/\,/, $line); should be... @lineData = split(/\//, $line); #parse 12/Mar/2004 the above results in: $lineData[0] = 12 $lineData[1] = Mar $lineData[2] = 2004 This is causing your comparison: if($lineData[18] == $date) to be wrong
split divides the string by the character to be split on and returns that many elements to the array. Thus resulting in an array of size 3 for each split per line.
my $line_date = "$lineData[0]/$lineData[1]/$lineData[2]"; if($line_date eq $date){ print "equal\n"; }
Use eq for comparing strings instead of ==

Replies are listed 'Best First'.
Re: Re: Parsing a date from comma-delimited file
by playing18 (Initiate) on Apr 12, 2004 at 18:26 UTC
    I think there may be some misunderstanding... $lineData is the array which has a bunch of data... item 18 is the element that I am instered in... The entry of the date by the user happens in a command prompt...