Why '' Is Matched First Time, Not Second Time
From: http://links.i6networks.com (SaveWorldFromAids_at_alexa.com)
Date: 08/21/04
- Next message: patrick: "Re: Problems installing DBI module on perl"
- Previous message: John Bokma: "Re: Any YahooPop/fetchyahoo Like For NNTP on Google?"
- Next in thread: Gunnar Hjalmarsson: "Re: Why '' Is Matched First Time, Not Second Time"
- Reply: Gunnar Hjalmarsson: "Re: Why '' Is Matched First Time, Not Second Time"
- Reply: Eric Bohlman: "Re: Why '' Is Matched First Time, Not Second Time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 21 Aug 2004 00:34:00 GMT
##################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?
- Next message: patrick: "Re: Problems installing DBI module on perl"
- Previous message: John Bokma: "Re: Any YahooPop/fetchyahoo Like For NNTP on Google?"
- Next in thread: Gunnar Hjalmarsson: "Re: Why '' Is Matched First Time, Not Second Time"
- Reply: Gunnar Hjalmarsson: "Re: Why '' Is Matched First Time, Not Second Time"
- Reply: Eric Bohlman: "Re: Why '' Is Matched First Time, Not Second Time"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|