in reply to How to give input and collect output of a perl script using another perl script
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to give input and collect output of a perl script using another perl script
by chakreey (Acolyte) on Mar 23, 2011 at 13:16 UTC | |
by GrandFather (Saint) on Mar 23, 2011 at 20:02 UTC | |
by chakreey (Acolyte) on Apr 07, 2011 at 10:09 UTC | |
by Anonymous Monk on Mar 23, 2011 at 14:11 UTC | |
by chakreey (Acolyte) on Mar 23, 2011 at 15:57 UTC | |
by GrandFather (Saint) on Mar 23, 2011 at 19:34 UTC |