in reply to Re^2: Help needed please: Data Manipulation in 2D Array
in thread Help needed please: Data Manipulation in 2D Array
my %cat2s_by_cat1; while (<$fh2>) { chomp; my ($cat1, $cat2) = split /=/; push @{ $cat2s_by_cat1{$cat1} }, $cat2; } while (<$fh1>) { chomp; my ($dog, $bird, $cat1) = split /=/; exists( $cat2s_by_cat1{$cat1} ) or die; for my $cat2 ( @{ $cat2s_by_cat1{$cat1} } ) { print $fh_out (join('=', $dog, $bird, $cat1, $cat2), "\n"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Help needed please: Data Manipulation in 2D Array
by Syntenty (Initiate) on May 05, 2008 at 06:53 UTC | |
by ikegami (Patriarch) on May 05, 2008 at 07:34 UTC | |
by Syntenty (Initiate) on May 05, 2008 at 08:04 UTC | |
by ikegami (Patriarch) on May 05, 2008 at 08:08 UTC | |
by Syntenty (Initiate) on May 05, 2008 at 09:30 UTC |