http://www.perlmonks.org?node_id=968778


in reply to Regexp to match regardless of whitespace

There's no modifier that let you skip anything.

If you're just grepping for string literals, it's trivial to change it to allow for spaces:

my $pattern = join '\s*', split //, "whatever"; while (<>) { print if /$pattern/; }
Otherwise, I'd do as suggested: remove the whitespace in the line, than apply the pattern.