in reply to Re^2: Error in coverage module
in thread Error in coverage module
In something like
print 'match' if $file =~ q|/Devel/|;
I'd be inclined to use qr|/Devel/| or better yet qr{ /Devel/ }xms (for various arcane reasons), or m//. But it may sometimes be useful to match directly against a string, either as a literal (but this seems rather quirky to me) or in a variable; as an example of the latter:
my $string = <$filehandle>;
...
do_something() if $something_else =~ $string;
(Of course, matching against a string read from an external source may have issues with metacharacter quoting, sanitization, etc.)
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Error in coverage module
by LanX (Saint) on Oct 16, 2019 at 12:40 UTC |