Just to check my understanding and that i'm learning this rite . :-)
while(<HD>){
next if /^\s*#|^\s*;/; .... ignors any lines with # and ;
next if /^\s*$/; .... ignores lines that start with a
space ..
my @array = split/\s+/; ... puts each value seperated by a space
into an array
my $key = shift @array; .... gets the first value, of the array and
sets key to this value
$hash{$key} = [EMAIL PROTECTED] || 'nodefined'; ... sets the value of the
hash
to the array ??
}
>From: "Gregory Machin" <[EMAIL PROTECTED]>
>To: "Jeff Peng" <[EMAIL PROTECTED]>
>CC: [email protected]
>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>
--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za