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"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how to get the String as regularexpression
by davorg (Chancellor) on Oct 03, 2006 at 14:43 UTC |
In Section
Seekers of Perl Wisdom