hi actuvally i posted how to create module after careful reading i create one module but i have some errors can tel me how to modify

Original content below restored by GrandFather

hi actuvally i posted how to create module after careful reading i create one module but i have some errors can tel me how to modify

my code
#!/usr/bin/perl use warnings; use strict; use XML::LibXML::Reader; #Reading XML with a pull parser my $file; open( $file, 'formal.xml'); my $reader = XML::LibXML::Reader->new( IO => $file ) or die ("unable t +o open file"); my %nums; while ($reader->nextElement( 'Data' ) ) { my $des = $reader->readOuterXml(); $reader->nextElement( 'Number' ); my $desnode = $reader->readInnerXml(); $nums{$desnode}= $des; print( " NUMBER: $desnode\n" ); print( " Datainfo: $des\n" ); }

i created lik this

#!/usr/bin/perl package Mymodule; use warnings; use strict; use Exporter qw(import); use Carp; use XML::LibXML::Reader; our @EXPORT_OK(myFunction); sub MyFunction { my $fh = shift; my $reader = XML::LibXML::Reader->new( IO => $fh ) or die ("u +nable to open file"); my %nums; while ($reader->nextElement( 'Data' ) ) { my $des = $reader->readOuterXml(); $reader->nextElement( 'Number' ); my $desnode = $reader->readInnerXml(); $nums{$desnode}= $des; } return %nums; } 1; my main function #!/usr/bin/perl use warnings; use strict; use Mypackage qw(myFunction); my $file; open( $file, 'formal.xml'); my %returnedHash = myFunction($file);

but i am getting errors like sysntax error at line 9 @export_ok in mypackage.pm and compilation error in main function line 4 (use mypackage qw(myfunction). i used right sysntax for export but i dnt know how to clear this.


In reply to help me with errors in perl module. by veerubiji

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.