H
http://links.i6networks.com
##################Perl File
my @line=(); my $foundcat=0;
my $keyword1=''; my $keywordcat='';
open ($INPUT, 'ostkall.txt') || die "can't open $file: $!";
while (<$INPUT>) {
chomp;
if (!($_=~ m/.+\|.+\|.+/)) {
if
($_=~ m/$keywordcat/i)
{
$foundcat=1;
print "FOUND $_\n";
} else {$foundcat=0;}
} #end of if (!($_=~ m/.+\|.+\|.+/)
}
close($INPUT) ;
#####################The output is
FOUND Computers & Printers|Monitors
But it should be
FOUND Computers & Printers|Monitors
FOUND Computers & Printers|Priners
#################the data in ostkall.txt is
Computers & Printers|Monitors
| | | | |
Computers & Printers|Printers
| | | | |
############# Question
Empty String '' is matched the first time but not the second time. Why?
my @line=(); my $foundcat=0;
my $keyword1=''; my $keywordcat='';
open ($INPUT, 'ostkall.txt') || die "can't open $file: $!";
while (<$INPUT>) {
chomp;
if (!($_=~ m/.+\|.+\|.+/)) {
if
($_=~ m/$keywordcat/i)
{
$foundcat=1;
print "FOUND $_\n";
} else {$foundcat=0;}
} #end of if (!($_=~ m/.+\|.+\|.+/)
}
close($INPUT) ;
#####################The output is
FOUND Computers & Printers|Monitors
But it should be
FOUND Computers & Printers|Monitors
FOUND Computers & Printers|Priners
#################the data in ostkall.txt is
Computers & Printers|Monitors
| | | | |
Computers & Printers|Printers
| | | | |
############# Question
Empty String '' is matched the first time but not the second time. Why?