in reply to Regexp to match regardless of whitespace
If you're just grepping for string literals, it's trivial to change it to allow for spaces:
Otherwise, I'd do as suggested: remove the whitespace in the line, than apply the pattern.my $pattern = join '\s*', split //, "whatever"; while (<>) { print if /$pattern/; }
|
|---|