for (my $i = 0; $i < @$sqlinfo; $i++)
{
my $user = $sqlinfo->[$i]{user};
# @check_user previously initiated - check here against previously found names to avoid showing duplicated to the screen
next if "@check_user" =~ /(^|\s)$user(\s|$)/;
my $number = sqlinfo->[$i]{number};
my $show = "$user";
my $first = sqlinfo->[$i]{first};
my $lastn = sqlinfo->[$i]{lastn};
my $tel = sqlinfo->[$i]{tel};
my $email = sqlinfo->[$i]{email};
# @number_check has been previously initiated before
if ("@number_check" =~ /(^|\s)$number(\s|$)/ )
{
# The $user values here are: Joe1 Mary1 Joe1 Mary1 from $user variable as an example, how to avoid showing duplicated values in $userfinal
# I am trying to show Joe1 and Mary1 I tried the code below but its not working.
#trying
my %unique;
if ($unique{$user})
{
next;
}
$unique{$user} = 1;
#end trying - if I use the above nothing shows.
#here its still printing all the names ignoring unique names.
print "
Print this to check if I only got unique user: *$user*
";
# @userfinal has been previously initiated before
$userfinal = "$userfinal