I had 1 perl script in which we write couple of subroutines. Example:
# Try_1.pl
main();
sub main{
---
---
check();
}
check {
--
--}
Now, i wrote another script Try_2.pl
, in which i want to call check subroutine of perl script Try_1.pl
.
It sounds like you want to create a module. Try_1.pm (Edit: note extension) should have the following form:
package Try_1;
use base 'Exporter';
our @EXPORT = qw(check);
sub check {
}
1;
And then Try_2.pl needs to get that code:
use Try_1 qw(check);
That what you're looking for?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With