[EMAIL PROTECTED] wrote:
On Jun 24, 3:31 am, [EMAIL PROTECTED] (Jeff) wrote:

Second, and equally important, what kind of data structure
should I put the results in? I think I need a hash of hashes

Probably a list of hashes would be the most natural.

my @LoH = map { { split } } $file_contents =~ /\{(.*?)\}/gs;

. What I'd like
to do is assign each left hand value as the key in a hash. Then, in each set
there's a left 'command' where the right hand value will always be unique,
which would be perfect for use as the name of an alias for the hash or as
the key to a reference to a hash of that definition.

my %HoH;
while ( $file_contents =~ /\{(.*?)\}/gs ) {
        my %entry = split;
        $HoH{delete $entry{command}} = \%entry;
}

Shouldn't that be:

while ( $file_contents =~ /\{(.*?)\}/gs ) {
        my %entry = split ' ', $1;
        $HoH{delete $entry{command}} = \%entry;
}



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

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


Reply via email to