Since there are the parameters which have multi-values,you could store the
values in an array and use this array's reference as hash's value.For
example:
while(<HD>){
next if /^\s*#|^\s*;/;
next if /^\s*$/;
my @array = split/\s+/;
my $key = shift @array;
$hash{$key} = [EMAIL PROTECTED] || 'nodefined';
}
From: "Gregory Machin" <[EMAIL PROTECTED]>
To: "Jeff Peng" <[EMAIL PROTECTED]>
CC: beginners@perl.org
Subject: Re: regex and parsing config file directives..
Date: Fri, 14 Jul 2006 12:36:55 +0200
here is basic config
All lines starting with ; or # are to be regarded as commented out ... as
are ignored..
client ### some of the directives are set jst by there
pressence
;dev tap
dev tun0
;dev-node MyTap
proto tcp
;proto udp
remote 192.168.1.1 1194
;remote my-server-2 1194
;remote-random
resolv-retry infinite
nobind
;user nobody
;group nobody
persist-key
persist-tun
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
;mute-replay-warnings
ca ca.crt
cert greg.crt
key greg.key
;ns-cert-type server
;tls-auth ta.key 1
cipher AES-128-CBC
comp-lzo
verb 3
;mute 20
On 7/14/06, Jeff Peng <[EMAIL PROTECTED]> wrote:
Could you paste your config file here?Then we could look at the situation
more clearly.
>looks good but my configs don't us "=" there is just a space ... so
could
>one use my ($key,$value) = split/\ /; to split the kay and the value ?
--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>