Miker has asked for the wisdom of the Perl Monks concerning the following question:
is it possible to use a scalar variable in a regex?
As in:
Of course this doesn't work:) but is there something that makes it work? Thanks for any enlightenment, Mike$date = "dec"; @months_we_ski = ("nov", "dec"); foreach $month (@months_we_ski) { if ($month =~ /$date/) { print "yep, we ski in $month\n"; } }
Back to
Seekers of Perl Wisdom