in reply to RE: RE: Making a Hash of Arrays
in thread Making a Hash of Arrays
If more description is needed than the comments provide, let me know.sub processfile { my ($file, $list) = @_; my $script = "/export/home/limo/Perl/exfields.pl -e"; my %hash; # no need for @list for my $arg (split /,/ => $list) { open(FILE, "$script $arg $file |") or die "System error: $!\n"; while (<FILE>) { # did you mean /^(#|none|unkno)/ ? next if /^#|none|unkno/i; chomp; $hash{$arg} = [split]; # or, if there'll be another $arg of the same value.. # push @{ $hash{$arg} }, split; } close FILE; } # consider return a REFERENCE to the hash... # it might be more memory-effective return %hash; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: RE: Making a Hash of Arrays
by Fastolfe (Vicar) on Sep 23, 2000 at 00:05 UTC | |
|
RE: RE: RE: RE: Making a Hash of Arrays
by Limo (Scribe) on Sep 23, 2000 at 00:25 UTC | |
by japhy (Canon) on Sep 23, 2000 at 00:42 UTC | |
by Adam (Vicar) on Sep 23, 2000 at 00:44 UTC |