I am trying to sort in perl. I need HELP. It is not working for me and I have tried everything and anything. Please advise me what to do.
example of database
name|company|address|state
I want to sort in company both in asc and desc
open (LISTDATA, "$database"
@indata = <LISTDATA>;
close (LISTDATA);
foreach $entries (<LISTDATA>){
@tline = split("|",$entries);
$newlines = $tline[1];
($name1, $company, $address, $state) = split(/\|/, $entries);
}
$i = 0;
foreach (sort values %newlines) {
#@pbx_print = split(/\|/,$newlines{$_});
if ($name eq "$name1" {
print "<form action=\"index.cgi\" method=\"POST\">\n";
print "<tr>\n";
print "<td class=distributor_field>$name</td>\n";
print "<td class=distributor_field><input type=\"submit\" class=submit value=\"Select\"></td>\n";
print "</tr>\n";
print "</form>\n\n";
$i++;
}
}
Thanks in Advance!
There
example of database
name|company|address|state
I want to sort in company both in asc and desc
open (LISTDATA, "$database"
@indata = <LISTDATA>;
close (LISTDATA);
foreach $entries (<LISTDATA>){
@tline = split("|",$entries);
$newlines = $tline[1];
($name1, $company, $address, $state) = split(/\|/, $entries);
}
$i = 0;
foreach (sort values %newlines) {
#@pbx_print = split(/\|/,$newlines{$_});
if ($name eq "$name1" {
print "<form action=\"index.cgi\" method=\"POST\">\n";
print "<tr>\n";
print "<td class=distributor_field>$name</td>\n";
print "<td class=distributor_field><input type=\"submit\" class=submit value=\"Select\"></td>\n";
print "</tr>\n";
print "</form>\n\n";
$i++;
}
}
Thanks in Advance!
There