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

Reply via email to