Gavin has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use diagnostics; my($line, $key, $value, $values); my %values = (); unless (open (INFILE, "inputHash.txt")){ die "Cant open input.txt\n";} # opens the file read only while (<INFILE>){ chomp; next unless (/\t/); my ($key, $value ) = split(/\t/, $_, 2); $values{$key}=$value; } close (INFILE); #close input file unless (open (OUTPUT, ">popHash.txt")){die "Cant open popHash.txt\n";} print OUTPUT "$values{$key} $value\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: populate hash tab delimited
by aquarium (Curate) on Mar 07, 2006 at 13:26 UTC | |
|
Re: populate hash tab delimited
by oknow (Chaplain) on Mar 07, 2006 at 13:24 UTC | |
by Anonymous Monk on Mar 07, 2006 at 22:04 UTC | |
|
Re: populate hash tab delimited
by rhesa (Vicar) on Mar 07, 2006 at 13:24 UTC | |
by Gavin (Archbishop) on Mar 07, 2006 at 22:44 UTC | |
by Gavin (Archbishop) on Mar 08, 2006 at 11:32 UTC | |
by rhesa (Vicar) on Mar 08, 2006 at 14:37 UTC |