> How can I test whether a person's name (which is the variable called
> $vars::name) is in a particular file ( "links.dat")? The
> file is simply a
> list of names all separated by the newline character, i.e,
>
> Harry\n
> Joe\n
> Jane Doe\n
>
> When I change my pattern-to-match to the literal string I'm
> testing for,
> say, "Harry", the code works. But it NEVER finds "$vars::name" .
>
Have you looked at the grep function? You might want something like...
...open file etc...
@names = <FH>;
@harrys = grep /harry/i, @names;
print "Found ", scalar @harrys, " Harrys in the file\n";
You can read up on it with perldoc -f grep.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]