Following is the code used in my CGI script.
my $query = $dbh -> prepare("SELECT * FROM invoices WHERE ID = '$ID'");
$query -> execute();
while (my @row = $query -> fetchrow_array()){
print "$row[1] - $row[2] - $row[3]<br>";
}
What If I want to remove dupes from @row? like if $row[2] is similar in
multiple records, only one entry should be showed, the duplicates should not
appear in the print.
I am aware of grep, but unable to implement it here in While loop.
@row = grep {++$count{$_} < 2} @row;
I am also aware that Unique keys can be added within mySQL database, but that's
un-do-able due to some reasons. I want to remove dupes within the script.
Any ideas?