in reply to Converting to ActivePerl
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.$ENV{FOO} = 'foo';
The regexes might need some adapting, depending upon what the contents of the batch file can be.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`;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting to ActivePerl
by jzielins (Initiate) on Oct 26, 2011 at 13:27 UTC |