Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my %myhash=(); my $myhash; sub do_hash { my ($filename)=@_; open(FH, $filename) or die "Can't open $filename: $!\n"; while(<FH>){ chomp; my ($Name, $Data)=split/\t/; } close FH; } open(DATA_LIST, "<data_list") or die "Can't open data_list to read!: $ +!\n"; while (<DATA_LIST>){ chomp; my ($Line,$Filed,$Dvalue)=split/\t/; #open(MYHASH, ">myhash") or die "Can't open myhash to write : $!\n"; do_hash("file_data"); print $myhash{$Line},"\n"; if (exists $myhash{$Line}){ print $Filed,"\t ",$Dvalue,"\t", $myhash{$Line},"\n"; } }
Edit kudra, 2002-05-22 Changed title, fixed code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash problem
by vladb (Vicar) on May 21, 2002 at 15:57 UTC | |
by Anonymous Monk on May 21, 2002 at 17:04 UTC | |
by Anonymous Monk on May 21, 2002 at 18:54 UTC | |
|
Re: hash problem
by DamnDirtyApe (Curate) on May 21, 2002 at 15:54 UTC | |
by Anonymous Monk on May 21, 2002 at 16:58 UTC | |
by Anonymous Monk on May 21, 2002 at 20:09 UTC | |
by Anonymous Monk on May 22, 2002 at 14:02 UTC | |
by DamnDirtyApe (Curate) on May 22, 2002 at 19:48 UTC | |
|
Re: hash problem
by licking9Volts (Pilgrim) on May 21, 2002 at 15:57 UTC | |
by dsheroh (Monsignor) on May 21, 2002 at 16:10 UTC | |
by Anonymous Monk on May 21, 2002 at 17:09 UTC | |
|
Re: hash problem
by educated_foo (Vicar) on May 21, 2002 at 16:01 UTC | |
by particle (Vicar) on May 21, 2002 at 18:34 UTC |