in reply to Re: calling perl subroutine from shell
in thread calling perl subroutine from shell

Calling perl subroutine from shell script and pass @ARGV's

Perl script : a.pl

#!/usr/bin/perl -w

use Exporter;
@ISA = qw(Exporter);
@EXPORT=qw(a(@ARGV));
sub a{
my($a,$b)=@_;

print $a."\n";
print $b."\n";
}
1;

Shell script : b.sh
#/bin/bash -e
arg1=1;
arg2=2;
perl -e "require qw(a.pl) ; a($arg1, $arg2);"

run ./b.sh

output :
1
2

  • Comment on Re^2: calling perl subroutine from shell