On Mon, Jun 04, 2001 at 01:48:15PM -0400, Jeff Pinyan wrote:
>
> 2. use a regex to get the key and value:
>
Just a tiny refinement. My usual config file stuff is:
> while (<CONFIG>) {
chomp;
s/\s+#.*//; #strip trailing comments
> next if /^#/; # skip commented lines
next if /^\s*$/; #skip blank lines
> my ($key, $value) = /(\S+)\s*=\s*(.*)/; # extract key/value
> chop $value if $value =~ /^['"]/; # remove quotes if they're there
> $CONFIG{$key} = $value;
> }
>
cheers
rob c
- regular expression chris robinson
- Re: regular expression Chas Owens
- Re: regular expression chris robinson
- Re: regular expression Chas Owens
- Regular Expression Satheesh Ramakrishnan
- Re: Regular Expression Jeff Pinyan
- Re: Regular Expression rob chanter
- Re: Regular Expression ISO-8859-1
- Re: Regular Expression Mathew Hennessy
- RE:regular expression Jorge Goncalvez
- RE: regular expression Jeff 'japhy/Marillion' Pinyan
- regular expression Messervy, Joe M
- Re: regular expression Jeff 'japhy/Marillion' Pinyan
- Regular Expression Lilian Alvarenga Caravela Godoy
- Re: Regular Expression John W. Krahn
- RE: Regular Expression John Edwards
