My question is I have two arrays that have data and some of the data is the same so I do not want to join the data if the same.
I am not sure how you would code this. here is what I have started and joins and sorts the data. but there are rowsof data that have the same thing (copy). What I am wating to do if the row is the same don't join both rows. only one. and if data in one list and not in other then am am going to do something...
I hope I have explained what I need help with.
CODE
my %numbers = ();
my $output = "";
open (DATABASE, "$data_file_path_1") || &file_open_error
("$data_file_path", "Display Frontpage", __FILE__, __LINE__);
while (<DATABASE>)
{
$line = $_;
chop $line;
@fields = split (/\|/, $line);
if ($fields[$index_of_status] eq "ok") {
$category = $fields[$index_of_category];
$numbers{$category}++;
}
$numbers1++;
push @goodads2, $line;
}
close (DATABASE);
print qq~
<font size=5><b>$session_username</b> you have <b><font color="#ff0000">$numbers1</font></b> .
</font>
<p>~
open (HITS_FILE, "$location_of_hits_file");
while ($line1 = <HITS_FILE>)
{
chop($line1);
@fields = split(/\|/, $line1);
if ($fields[1] eq "$session_username")
{
push @goodads, $line1;
push @goodads1, $fields[0];
#print qq~ $line1 ~;
}
}
}
else
{
}
close (HITS_FILE);
open(DATAFILE, "$data_file_path_1") ||
&file_open_error("$data_file_path_1",
"Read Database",__FILE__,__LINE__);
while(($line = <DATAFILE>))
{
chop($line);
my @allgoodads = (@goodads2, @goodads); # two sets of data
@sorted = sort {$a <=> $b} @allgoodads; # sort numerically
foreach $line (@sorted)
{
@fields = split(/\|/, $line);
################other code here
last;
} # End of while datafile has data
close(DATAFILE);
print qq~
</table><p>~;
This post has been edited by winracer: 5 Nov, 2009 - 05:48 AM