On Jun 24, 9:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote:
> [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;
>
> }
Well actually I'd meant foreach() rather than while(). But using
while() and $1 is arguably better.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/