I'm trying to store a s/ / /g
regex as a variable (without much luck).
Here is an example that uses a normal match to show what I intend to do.
my %file_structure = (
header => qr/just another/,
table => qr/perl beginner/,
)
Now I can call this using $line =~ $file_structure{'header'}
and it will return undef
, or true
if the pattern matches.
However I would like to say $line =~ $file_structure{'foo'}
where $file_structure{'foo'}
contains something like s/beginner/hacker/g
.