in reply to A Love/Hate Relationship - A Long Time Newbie's Current Block
#!/usr/bin/perl use strict; use warnings; open my $fh_a => "> a.txt" or die "open a.txt: $!"; open my $fh_b => "> b.txt" or die "open b.txt: $!"; open my $fh_c => "> c.txt" or die "open c.txt: $!"; my @a = qw /60622 60516 60201/; my @b = qw /90210 60622 12345/; my @c = qw /11412 32134 60201/; my %data; @data {@a} = ($fh_a) x @a; @data {@b} = ($fh_b) x @b; @data {@c} = ($fh_c) x @c; while (<DATA>) { chomp; my ($fn, $ln, $id) = split /,/; next unless $data {$id}; print {$data {$id}} "$_\n"; } close $fh_a or die "close a.txt: $!"; close $fh_b or die "close b.txt: $!"; close $fh_c or die "close c.txt: $!"; __DATA__ Homer,Simpson,60622 Clark,Kent,90210 Fred,Flintstone,00987
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A Love/Hate Relationship - A Long Time Newbie's Current Block
by flounder99 (Friar) on Nov 05, 2003 at 19:21 UTC |