in reply to Trying to make a search Part 2
#!/usr/bin/perl use warnings; print "Search for what: "; chomp(my $search = <STDIN>); @words = split(/ /, $search); open(DATA, "books.txt") or die "error opening file $!"; while (<DATA>) { foreach $word(@words) { chomp($word); if (/$word/i) { print; } } }
But now how would I get it to only print out the entry once even when there are multiple matches
-- zdog (Zenon Zabinski)
Go Bells!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Trying to make a search Part 2
by swiftone (Curate) on Jun 05, 2000 at 20:05 UTC | |
|
RE: Re: Trying to make a search Part 2
by Adam (Vicar) on Jun 05, 2000 at 20:05 UTC |