anitsahu has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to invoke a subroutine of a particular perl module and passing an argument as well ,where the subroutine ,the perl module and the argument are parsed from a xml file, but everytime the passed argument in the invoked subroutine gets the name of the perl module..pls help me out i am providing the code below
use NAS; use RRC; use Layer1; use Cwd; use XML::Simple; use Data::Dumper; $xml = new XML::Simple (KeyAttr=>[]);# read XML file $config =$xml->XMLin("Config_test.xml"); $top = $config->{ConfigRoot}; $start =$top->{debugDef}; $begin =$start->{general}; open report,">report.txt"; foreach my $var(@{$begin->{genCategory1}}){ print report $var->{sysTag},"\n\n\n"; $str=$var->{pm}; foreach my $var1(@{$var->{genCategory2}}){ print report $var1->{name},"\n\n"; $str1=$var1->{subroutine}; $regexp=$var1->{searchStr}; print $regexp,"\n"; $str->$str1($regexp);
where NAS,RRC and Layer1 are the name of the perl modules,the line $str->$str1($regexp); always passes $str as parameter to the subroutine..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: invoking subroutines
by syphilis (Archbishop) on Jul 01, 2011 at 01:04 UTC | |
|
Re: invoking subroutines
by ig (Vicar) on Jul 01, 2011 at 07:19 UTC |