A
Adam Briska
Given the script:
--------
use strict;
use warnings;
my $text = 'blob:blob';
doit($text);
doit($text);
doit($text);
sub doit
{
my ($aa) = @_;
if( $aa =~ m?[^:]+:.*? ) {
print "Good!\n";
}
else {
print "Bad! \n";
}
}
----
This produces the output:
Good!
Bad!
Bad!
-----
I think that I may have a mistake on the regular expression syntax,
but why does this show one behavior once and another behavior for all
subsequent calls?
If I change the regex to m/[^:]+:.*/ it works fine.
I was under the impression that I could use any delimiter around my
regex, but I seem to be mistaken.
-Adam
--------
use strict;
use warnings;
my $text = 'blob:blob';
doit($text);
doit($text);
doit($text);
sub doit
{
my ($aa) = @_;
if( $aa =~ m?[^:]+:.*? ) {
print "Good!\n";
}
else {
print "Bad! \n";
}
}
----
This produces the output:
Good!
Bad!
Bad!
-----
I think that I may have a mistake on the regular expression syntax,
but why does this show one behavior once and another behavior for all
subsequent calls?
If I change the regex to m/[^:]+:.*/ it works fine.
I was under the impression that I could use any delimiter around my
regex, but I seem to be mistaken.
-Adam