1
2
3
4
set Variable1=c:/ursprungspfad/site1
set Variable2=%Variable1%/info
set Variable3=verzeichnis
set Variable4=%Variable1%/%Variable3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if ($_ =~ /^set/)
{
$_ =~ s/^set //g;
($var, $wert) = split(/=/, $_);
if($wert =~ /\%*\%/)
{
$wert =~ s/\%.*\%/$1/;
#?????
$ENV{'var'}=
#?????
}
else
{
$ENV{'$var'}=$wert;
}
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#! /usr/bin/perl use strict; use warnings; # use Getopt::Long; # use CGI; my %foo; while ( my $line = <DATA> ) { if ( my ( $var, $wert ) = $line =~ m{set\s+([^=]+)=(.+)$} ) { if ( $wert =~ m/%/ ) { $wert =~ s/%([^%]+)%/$foo{$1}/g; } $foo{$var} = $wert; } } use Data::Dumper; print Data::Dumper->new( [ \%foo ], [ '*foo' ])->Sortkeys(1)->Dump; __DATA__ set Variable1=c:/ursprungspfad/site1 set Variable2=%Variable1%/info set Variable3=verzeichnis set Variable4=%Variable1%/%Variable3
1
2
3
4
5
6
%foo = (
'Variable1' => 'c:/ursprungspfad/site1',
'Variable2' => 'c:/ursprungspfad/site1/info',
'Variable3' => 'verzeichnis'
'Variable4' => 'c:/ursprungspfad/site1/%Variable3',
);