tosaiju has asked for the wisdom of the Perl Monks concerning the following question:
I have a situation with regex and a function call which dumps some junk (control) characters in match variables($1, $2)
The codes are something like below,
Here $var1 is getting some junk control characters which was never part of match. Could you please help to get some light into why this is happening?If($str =~ m/(pattern1)(pattern2)/gi) { $str = &function($1); $var1 = &function($2); }
On another note, code-1: works fine on Windows system and shows junk Only on Linux. Code-2, works fine on both systems.If($str =~ m/(pattern2)/gi) { $var1 = &function($1); If($str =~ m/(pattern1)pattern2/gi){ $str = &function($1); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex, Function and Default variables
by kcott (Archbishop) on Nov 20, 2013 at 07:48 UTC | |
|
Re: Regex, Function and Default variables
by GrandFather (Saint) on Nov 20, 2013 at 07:44 UTC | |
|
Re: Regex, Function and Default variables
by Anonymous Monk on Nov 20, 2013 at 07:48 UTC | |
|
Re: Regex, Function and Default variables
by oiskuu (Hermit) on Nov 20, 2013 at 11:57 UTC | |
by tosaiju (Acolyte) on Nov 21, 2013 at 09:00 UTC |