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?
Try_1.pm and placed in your @INC path.@EXPORT you do not need to explicitly import the function check in Try_2.pl, a simple use Try_1 will work. You may use @EXPORT_OK to require an explicit import.