1

I am executing a Perl script from a Windows batch file.

I'd like to pass a variable set in the Perl script back to the Windows batch file.

I've tried a number of commands with no success:

Windows batch file (calling.bat)

for /f "delims=*" %%p in ('perl c:\TEMP\BFT\called-perl-script.pl') do ( set myVar=%%p )

perl -w c:\TEMP\BFT\called-perl-script.pl %myVar%

Note: Taken from How do I pass the input from another perl script in batch file

Perl script (called-perl-script.pl)

$myVar = "YES";

The Windows batch file should receive the $myVar (i.e. YES) variable value.

Note: I'm using Strawberry Perl.

Any help would be greatly appreciated.

Thanks in advance.

ikegami
  • 343,984
  • 15
  • 249
  • 495
Billy J
  • 111
  • 10

1 Answers1

3
$myVar = "YES";

should be

print "YES";
ikegami
  • 343,984
  • 15
  • 249
  • 495