On Fri, Mar 14, 2008 at 8:08 PM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
> Kashif Salman wrote:
>  > I have a config file with stanzas that I need to parse,
>
>  <snip>
>
>
>  > define name1{
>  >     variable=value
>  >     variable2=value2
>  > ..
>  > }
>  > define name2{
>  >     variable=value
>  >     variable2=value2
>  > ...
>  > }
>
>      use Data::Dumper;
>      my %HoH;
>      {
>          local $/ = "}\n";
>          while (<>) {
>              if ( /^define\s+(\w+){\s+(.+)}/s ) {
>                  my ($name, $vars) = ($1, $2);
>                  while ( $vars =~ /^\s*(\w+)=(\w+)/gm ) {
>                      $HoH{$name}{$1} = $2;
>                  }
>              }
>          }
>      }
>      print Dumper \%HoH;
>
>  --


Thanks Gunnar, that's more doable for me than trying to decode the
StanzaFile. I will try this out.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to