D
dn.perl
Here is the code:
#!/usr/local/bin/perl
use strict ;
use warnings ;
my $counter = 1;
my $log = "[pattern number-405] check" ;
print "log is:$log\n" ;
while ( $log =~ /(pattern)( \S+-\d+)+/ig )
{
my $match = $& ; ## $& is the str yielded by the last pattern
match
$match =~ s/^\S+ // ; # remove first word
print "match is $match\n" ;
last if $counter++ > 25 ;
}
print "log is:$log\n" ;
# - - - - - - - - - - -
Why does the loop break after just the first pass? I would expect the
while condition to never change in this patch.
#!/usr/local/bin/perl
use strict ;
use warnings ;
my $counter = 1;
my $log = "[pattern number-405] check" ;
print "log is:$log\n" ;
while ( $log =~ /(pattern)( \S+-\d+)+/ig )
{
my $match = $& ; ## $& is the str yielded by the last pattern
match
$match =~ s/^\S+ // ; # remove first word
print "match is $match\n" ;
last if $counter++ > 25 ;
}
print "log is:$log\n" ;
# - - - - - - - - - - -
Why does the loop break after just the first pass? I would expect the
while condition to never change in this patch.