in reply to Converting to ActivePerl

The perl program is capable of setting environment variables - eg:
$ENV{FOO} = 'foo';
but, for your script to be able to do that, you need to know in advance the names of these env vars, and the values they need to take on.

If that's not the case, then things get a bit more complicated.
I would probably open the batch file for reading and parse its contents for the settings that need to be made:
use strict; use warnings; open RD, '<', 'foo.bat' or die $!; while(<RD>) { if($_ =~ /set\s/i) { my @v = split /=/, $_; my $n = (split /\s/, $v[0])[-1]; $ENV{$n} = $v[1]; print "\$ENV{$n} : $ENV{$n}\n"; } } my @progname_output = `progname l`;
The regexes might need some adapting, depending upon what the contents of the batch file can be.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Converting to ActivePerl
by jzielins (Initiate) on Oct 26, 2011 at 13:27 UTC
    Thank you.