Try this:
my $stringToMatch = "hello";
my $runtimeRegExp = "he";
print $stringToMatch." world" if($stringToMatch =~ /$runtimeRegExp/gi);
At 09:23 22.05.2001 -0400, you wrote:
>Hi people,
>
> I need to match string against regular expressions that are only
>known at run-time. I'm having problems doing it so I made a small test
>script like the following :
>
>#!/net/tcmvega35/data1/automation/perl/bin/perl -w
>
>use strict;
>die "test.pl [string] [regex]" unless $#ARGV == 1;
>
>if ($ARGV[0] =~ $ARGV[1])
>{
> print "$ARGV[0] matches $ARGV[1]\n";
>}
>else
>{
> print "$ARGV[0] does not match $ARGV[1]\n";
>}
Aaron Craig
Programming
iSoftitler.com