I'd vote for modify compare.pl into compare.pm. Actually I'd copy compare.pl to Compare.pm and add:
package Compare; # modified original contents of compare.pl here 1;
The package line at the top and the (implicit return) 1 at the end are pretty much all the extra stuff you need. In your calling script you:
#!/usr/bin/perl use strict; use warnings; use Compare; ... Compare::SomeSubInTheCompareModule ();
Notice the way sub SomeSubInTheCompareModule is called by using the package name. Aside from that icing a sub in Compare is called and used in just the same way as a sub in the .pl file.
In reply to Re: How to give input and collect output of a perl script using another perl script
by GrandFather
in thread How to give input and collect output of a perl script using another perl script
by chakreey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |