http://qs321.pair.com?node_id=458216

silent11 has asked for the wisdom of the Perl Monks concerning the following question:

I am in the process of brushing up on my perl basics, reviewing Learning Perl, etc.

I am have a little question dealing with Regex anchoring patterns.

my $string = 'silent eleven'; if ($string =~ /\b \b/){ print "yes to 1\n"; } if ($string =~ /\b \b$/){ print "yes to 2\n"; } if ($string =~ /\b$/){ print "yes to 3\n"; }
Output:
Z:\>perl anchor.pl yes to 1 yes to 3
Why is the second if statement not returning true? Can these 2 "anchors" not be next to each other? Perhaps I am missing the point of using anchors. Any help or explanation would be appreciated.


-silent11
Spread Firefox