Hi,
I tried the following code snippet from Robert's Perl tutorial (link text):
> $_='My email address is
> <[email protected]>.';
>
> print "Found it ! :$1:" if /(<*>)/i;
When I ran it, the output was:
Found it ! :>:
However, shouldn't the output be,
Found it ! :m>:
since 'm' matches "0 or more '<' i.e the '<*' part of the regex"
Also,
$_='My email address is <[email protected]>.';
print "Match 1 worked :$1:" if /(<*)/i;
When this is run the output is:
Match 1 worked ::
$_='<My email address is <[email protected]>.';
print "Match 2 worked :$1:" if /(<*)/i;
When the above is run, the output is:
Match 2 worked :<:
But shouldn't the output be:
Match 2 worked ::
since the first match (i.e. $1) is "" rather than "<", like the example before it.