Hi Sachin!
It is certainly possible to split the "main" package across several .pl files. However I would not recommend that approach. I would put your unzipping sub in a module. You can look at
Module Tutorials for a lot of info about making modules.
To get you started, here is something that you can just cut-n-paste your code into.
#!/usr/bin/perl
# This is a main program...
use strict;
use warnings;
use ZipUtilDemo; #unzipping imported by default here
print "starting main program\n";
unzipping(); #call unzipping sub in module ZipUtilDemo.pm
__END__
Prints:
starting main program
Sub unzipping called!
The module:
#!/usr/bin/perl
#This is file: ZipUtilDemo.pm
package ZipUtilDemo;
use strict;
use warnings;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
use Exporter;
our $VERSION=1.00;
our @ISA = qw(Exporter);
our @EXPORT = qw( unzipping );
our @EXPORT_OK = qw( );
sub unzipping
{
print "Sub unzipping called!\n"; #of course real code goes here.
}
1; #IMPORTANT return a true value!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.