Hi Everyone. I have trying to create a module in perl,but it is not behaving as thought. The Perl Module code is :
package iVPU_Parameter; require Exporter; @ISA=qw(Exporter); @EXPORT = qw(Configchk); sub Configchk() { &a=$_[0]; @arr_iVPU_standard=$_[1]; @arr_iVPU_current=$_[2]; blah blah blah }
I saved the file as iVPU_Parameter.pm and i am calling this module from a progam code:
use warnings; use iVPU_Parameter; $vlan_id=xxx; open(FH_CURRENT,"Running.txt"); open(FH_STANDARD,"Standard.txt"); @iVPU_current=<FH_CURRENT>; @iVPU_standard=<FH_STANDARD>; &Configchk($vlan_id,@arr_iVPU_standard,@arr_iVPU_current);
It is able to call the module But when i try to print the array arguments in the Perl Module iVPU_Parameter.pm,by
print @arr_iVPU_standard;
it does not print that ,but when i do the same in the calling program,it prints there so there is no problem in file handling.So i think the problem is in parameter passing or scope of the arguments. Also when i remove the ampersand (&) from the line
&Configchk($vlan_id,@arr_iVPU_standard,@arr_iVPU_current);
it shows the error as Too Many arguments . Could you please help in this matter.

In reply to Module Creation and Function Call by girish_01

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.