On 6/16/06, Alan_C <[EMAIL PROTECTED]> wrote:
[snip]
1 'build' slack build slackbuild sbuild pkg
2 'build' slack build slackbuild sbuild pkg
3 'build' slack build slackbuild sbuild pkg
4 'kernel' slackware 2.6 kernel howto
5 'kernel' kernel compile install 2.6
6 'build' building a linux kernel from source
7 'kernel' building a linux kernel from source
[snip]
for my $keyline ( @lines ) {
my $filename = shift @$keyline;
for my $search ( @search4 ) {
for ( @$keyline ) {
if ( /$search/ ) {
# How to not have duplicated keyword lines?
# the next line I don't understand. How to get it hash like?
push @{ $data{ $filename } }, $_; # I think this line cause
# print ++$found_tally . " " . $search,@$keyline, "\n"; #
prints keyline 4 ea found
print ++$found_tally," '$search' @$keyline\n\n";
last;
}
}
}
}
Notice that the first three matches are the same, and the word build
occurs 3 times in that one @$keyline array. Sounds like you want to
stop looping over [EMAIL PROTECTED] after your first match.
Dave
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>