Home: Perl Programming Help: Regular Expressions:
Strange behaviour $1 ... $10...variables scope



subbareddy
New User

Dec 11, 2006, 8:16 AM


Views: 7135
Strange behaviour $1 ... $10...variables scope

Dear PerlGurus,

Why this been built like this? Scope of the $1 ... $10 .... variable in the sub functions or next reguler exprsn results checking level is being getting effected and it's strange and dangers check points, if the user dependent on these variables.

sub fun1() {

$string1 = /(english).*(book).*/i;

...

$string2 = 'Hindi';

$returnStatus = &fun2($string2);

}



sub fun2() {

#Delete the books info, if found

/(book)/i;

eval {

$deleteBooks->execute($date) if($1);

return 0;

};if($@) { print "$@"; return 1;}



}


davorg
Thaumaturge / Moderator

Jan 8, 2007, 7:34 AM


Views: 7102
Re: [subbareddy] Strange behaviour $1 ... $10...variables scope

Please explain exactly what problems you are having. Your current question isn't very clear.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks