in reply to Re: combining 2 files with a comon field
in thread combining 2 files with a comon field
and got:use strict; use warnings; open FILE1, '<', 'file1' or die ($!); my %file1 = map { split '\|', $_ } <FILE1>; ## we now have A1=>'dog' in hash close FILE1; for(sort keys %file1){ print "$_\n"; print join('|',$_,$file1{$_}),'|',"\n"; }
||
A1
A1|dog|
A3
A3|bird|
cat
cat|
|
file1 is:
A1|dog|
A2|cat|
A3|bird|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: combining 2 files with a comon field
by radiantmatrix (Parson) on May 18, 2005 at 20:42 UTC | |
|
Re^3: combining 2 files with a comon field
by BerniBoy (Acolyte) on May 18, 2005 at 19:43 UTC |