| Subject: | Re: Modifying StanzaFile |
|---|---|
| From: | Gunnar Hjalmarsson |
| Date: | Sat, 15 Mar 2008 04:08:05 +0100 |
| Newsgroups: | perl.beginners |
Kashif Salman wrote: I have a config file with stanzas that I need to parse, <snip>
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;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: subroutine in here document, Jenda Krynicky |
|---|---|
| Next by Date: | Re: Modifying StanzaFile, Kashif Salman |
| Previous by Thread: | Modifying StanzaFile, Kashif Salman |
| Next by Thread: | Re: Modifying StanzaFile, Kashif Salman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |