in reply to Trying to make a search Part 2

For future reference, please be more specific on what isn't working.

Your first line:
#/usr/bin/perl
Should be:
#!/usr/bin/perl
This is an operating system thing, not a perl thing, and won't affect you if you are using a Windows system or calling the script from the command line (e.g. "perl myscript.pl")

open(DATA, "data.txt") or die "error opening file $!"; @data = <DATA>;
Update: As many (sean, infoninja, and mdillon have pointed out, @data=<DATA> is correct.
<strikeout>I believe your problem might be here. <DATA> returns a string. @data is an array. Also, you are only getting the first line from DATA, not all the lines.</strikeout>
if ($data =~ /$word/) {
Note that this is case-sensitive. You might want to use /$word/i to make it insenstive.

Replies are listed 'Best First'.
RE: Re: Trying to make a search Part 2
by nuance (Hermit) on Jun 06, 2000 at 00:10 UTC
    forget this, i was talking crap.

    Nuance

    Baldrick, you wouldn't see a subtle plan if it painted itself purple and danced naked on top of a harpsichord, singing "Subtle plans are here again!"