in reply to Regex, Function and Default variables
G'day tosaiju,
$2 is probably being modified somewhere between the two calls to function().
You've posted If instead of if. This should generate a syntax error. Instead of typing your code by hand when posting, copy and paste it: less effort; more accurate! It also means we're seeing your real code.
Also, do you need the leading &s? See perlsub.
Without seeing more of your code, I'd suggest something along these lines (untested):
if ($str =~ m/(pattern1)(pattern2)/gi) { my ($arg1, $arg2) = ($1, $2); $str = function($arg1); $var1 = function($arg2); }
-- Ken
|
|---|