#! /usr/bin/perl use strict; use warnings; # use Getopt::Long; # use CGI; my %foo; while ( my $line = ) { 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