how do i use scalar variables in substitution and complex matching?

eg I want the following to work.

$string =~ s/^$variable//;

$string =~ m/^([^$variable]*)/;

----------------------------------------------


Do a search for "perl regex" and you'll find all kinds of info.

- Chris


$foo='The Quick Brown Fox';
$bar='brown';
$color='Orange';

print "Found 1\n" if ($foo=~/$bar/);  # Case sensitive

print "Found 1\n" if ($foo=~/$bar/i); # Case insensitive

$foo=~s/$bar/$color/gi;   # Case insensitive greedy substitution

print "$foo\n";

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to