in reply to Regex vs. string

Note also that there are some subtle differences between a literal pattern, and a string used as a pattern, eg
$foo =~ /\ba\b/; # match the word "a" $foo =~ "\ba\b"; # match the three characters # backspace(\x08), "a", backspace

update: changed bell to backspace as per TimToady's nitpick

Dave.

Replies are listed 'Best First'.
Re^2: Regex vs. string
by TimToady (Parson) on Jul 09, 2005 at 18:33 UTC
    Mmm, actually, \x08 is a backspace, to pick small nit. A \a would produce a bell (though it's not clear whether we'll carry that one over to Perl 6).