my $q=new CGI;
my $code=$q->param('code');
@lines=split (/\n/, $code);
print "Content-type: text/html\n\n";
print "<html>
<head>
<title>Sorted text</title>
<H1>Sorted and numbered text</H1><PRE>";
my $loop=1;
foreach (@lines) {
print $loop."WWW".$_."\n";
$loop++;
};
print "</PRE></body></html>";
to include these little codes...
# Remove duplicates
my %unique;
@unique{map {lc} @lines} = @lines;
# Then sort
print "$unique{$_}<br />" foreach sort {$a cmp $b} keys %unique;
to Remove duplicates and sort, and then number the form POST info?
yahoo
Commission Junction
google
msn
Microsoft
dmoz
Commission Junction
Azoogle
Amazon
msn
dmoz
ClickBank
Commission Junction
Chitika
dmoz
in to a form and it spits out...
1WWWAmazon
2WWWAzoogle
3WWWChitika
4WWWClickBank
5WWWCommission Junction
6WWWdmoz
7WWWgoogle
8WWWMicrosoft
9WWWmsn
10WWWyahoo
and it can have numbers, letters and characters in the stuff to sort/remove duplicates.
#!/usr/bin/perl
use CGI ':standard';my $q=new CGI;
my $code=$q->param('code');
@lines = split (/\n/, $code);
# Remove duplicates
my %unique;
# Remove duplicates
@unique{map {lc} @lines} = @lines;# Then sort
print "$unique{$_}<br />" foreach sort {$a cmp $b} keys %unique;
# Then sort
print "$unique{$_}<br />" foreach sort {$a cmp $b} keys %unique;print "Content-type: text/html\n\n";
print "<html>
<head>
<title>Sorted text</title>
<H1>Sorted and numbered text</H1><PRE>";
my $loop=1;
foreach (sort keys %unique) {
print $loop."WWW".$_."\n";
$loop++;
};
print "</PRE></body></html>";