I'm moving database data from table to table and want to make sure I'm getting only unique records.
Only want unique $field1 and was looking at the cookbook code, but for that I have to populate a hash and then re-inspect through before inserting uniques, something like :
%ucnt = (); while (my @row = $sth->fetchrow) {
$field1 = $row[0]; push(@list,$field1 ); $ucnt{$_}++; $field2 = $row[3]; }
@uniq = sort keys %ucnt; foreach $item (@uniq) { POPULATE TABLE............ }
Surely I can avoid the "foreach" and inspect $field1 in the while loop for uniqueness before pushing it to an array.
Cheers, Mark
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>