in reply to grep string

You could first read in the first line like so:
open FILE, "<file.txt" or die "Could not open file.txt: $!"; my $line = <FILE>; close FILE;
I am not sure what you are trying to grep here, but your unwanted matches are due to two reasons: you didn't escape the metacharacter `.' and you probably didn't exclude stuff off the end of the string. Try something like, e.g.,
$line =~ m|^\Q$path/$file\E$|;
The ^ and $ make the regexp match just the exact string and nothing else on the line, and the \Q...\E quote any metacharacters in your string.

-Mark

Replies are listed 'Best First'.
Re: Re: grep string
by amoura (Initiate) on Jun 25, 2002 at 21:09 UTC
    thanks dude , it worked ;)