
japhy
Enthusiast
Mar 15, 2000, 6:43 AM
Post #3 of 3
(2508 views)
|
Yes, don't use a regex here. If you're curious, though, how to anchor "end of string" in a regular expression you can use: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $a = "this"; $a =~ s/$/ that/; # "this that" $a = "this\n"; $a =~ s/$/ that/; # "this that\n" $a = "this\n"; $a =~ s/\Z/ that/; # "this that\n" $a = "this\n"; $a =~ s/\z/ that/; # "this\n that" </pre><HR></BLOCKQUOTE> $ and \Z and \z are described in 'perlre'.
|