shamala has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl my %hash_mnt=(); @Mounts= `mount`; $count=0; foreach $mount(@Mounts){ $count++; print "$count\n"; ($mnt_key,$mnt_val,$mnt_acc)=(split(/\s+/,$mount))[2,0,6]; + <li> I want to + create a hash here </li> <li> multidimensional hash with mnt_key as key and mnt_val and mnt_acc + as values</li> }
I tried :
#!/usr/bin/perl my %hash_mnt=(); @Mounts= `mount`; foreach $mount(@Mounts){ ($mnt_key,$mnt_val,$mnt_acc)=(split(/\s+/,$mount))[2,0,6]; push( @{$hash_mnt{$mnt_key}[0]}, $mnt_val ); push( @{$hash_mnt{$mnt_key}[1]}, $mnt_acc); + }
But this isnt working
Am i missing something???
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic creation of hashes
by Aristotle (Chancellor) on Aug 14, 2004 at 08:03 UTC | |
|
Re: Dynamic creation of hashes
by wfsp (Abbot) on Aug 14, 2004 at 08:07 UTC | |
|
Re: Dynamic creation of hashes
by jdalbec (Deacon) on Aug 14, 2004 at 14:04 UTC |