Thread ksh-Befehl in perl? (5 answers)
Opened by schuetze09 at 2008-10-13 11:11

Ronnie
 2008-10-13 12:01
#115449 #115449
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
Tipp: Evtl. mal im CPAN schauen was die dortigen Module zum .ini-Dateien parsen können.
Code: (dl )
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
#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Carp;

my %config;

while(my $line = <DATA>) {
chomp($line);
my ($k, $v) = ($line =~ m/^\s*(\w+)\s*=\s*(.*)\s*$/);
if (defined $k and defined $v) {
$v =~ s/['"]//g;
if ($v =~ m/^\$(.*)/) {
$v = $config{$1};
}

$config{$k} = $v;
}
}

carp Dumper \%config;

__DATA__
VERTEILER='mustermann@muster.de'
EMAILS=$VERTEILER

View full thread ksh-Befehl in perl?