$ perl -Mstrict -Mwarnings -Mautodie -e ' my %conf; open my $fh, "<", "foo.conf"; my $data = do { local $/; <$fh> }; $conf{$1} = $2 while $data =~ /(\w+)="([^"]*)"/g; s/\$(\w+)/$conf{$1}/g for values %conf; use Data::Dumper; print Dumper \%conf; ' $VAR1 = { 'A' => 'foo', 'C' => 'appending foo', 'B' => 'some other data', 'D' => ' some list with more data and some other data ' };