in reply to Re^2: How to match a ;
in thread How to match a ;
I'm puzzled as to why you switched to double quotes and then had to escape the backslash in your third pattern. Sticking to single quotes or using qw{ ... } would have obviated that need.
$ perl -le ' > $line = qq{;\n}; > print > $line =~ m{$_} > ? q{} > : q{no }, > qq{match $_} > for q{^;$}, q{^;}, q{^;\z};' match ^;$ match ^; no match ^;\z $ perl -le ' $line = qq{;\n}; print $line =~ m{$_} ? q{} : q{no }, qq{match $_} for qw{ ^;$ ^; ^;\z };' match ^;$ match ^; no match ^;\z $
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to match a ;
by GrandFather (Saint) on Feb 09, 2009 at 00:41 UTC |