go ahead... be a heretic | |
PerlMonks |
Re^2: Joining two files on common fieldby Skeeve (Parson) |
on Sep 23, 2005 at 06:10 UTC ( [id://494410]=note: print w/replies, xml ) | Need Help?? |
You said: That's pretty brittle in a number of ways: ... it depends rigidly on a particular ordering and quantity of columns in each file So let's fix that. $_ = <I1>; # read column headings becomes
And when reading the columns, instead of my ($upc,$qty) = split /,/; and my ($sku,$siz,$clr,$upc) = split /,/; we put @line{@columns}= split /,/; (provided you have a my %line; defined) So in full:
$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print
In Section
Seekers of Perl Wisdom
|
|