How to pass parameters from batch file to the array in perl?

Viewed 83

I am new in Perl. Could you please give me advice to pass parameters from batch file to the array in Perl? Or is it possible?

Batch file:

@echo off
C:\Perl64\bin\perl.exe D:\perl\prog.pl a 30 5 d o 78 g

and read these parameters from the array in Perl script and print on the screen:

($st, $st2, $com, $ep, $co, $vel, $sig) = @_;

print @_;
1 Answers

Try this way:

Sample.bat Batch File contents:

perl -w d:\testing\SampleScript.pl %1 %2 %3

SampleScript.pl Script contents:

my ($arg1, $arg2, $arg3) = @ARGV;

print "First Param... $arg1\n";

print "Second Param... $arg2\n";

print "Third Param... $arg3\n";

On your Prompt:

$: Sample.bat Parrot Pigeon Duck

Thanks

Related