in reply to Re: regex issue
in thread regex issue

using the index work but it only checks for the name , I am trying to see if the age match as well, I will skip that line only if the name and age match. thanks

Replies are listed 'Best First'.
Re: Re: Re: regex issue
by optimist (Beadle) on Feb 28, 2004 at 00:46 UTC
    Well, then, you need to match on both the name and the age:
    $found = 1 if /^\s*\Q$student\E\s+\Q$studentAge\E\s*$/
    should do the trick. If no one else ever touches the file, you can get away with eliminating with \s* on either side, but I figure they don't hurt, on the off chance someone brings the data file into an editor at some point.