in reply to how to get the String as regularexpression
Have a look at the qr-operator
sample:
sample:
#!/usr/bin/perl use strict; use warnings; my $extensions = qr/\.doc|\.gif/; my @files = qw(test.doc test.gif test.png test.jpg); for(@files){ if($_ =~ $extensions){ print "yes\n"; } }
In Section
Seekers of Perl Wisdom