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..


In reply to invoking subroutines by anitsahu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.