|
| |
CGI Scripts
|
Web Hosting Services |
sort_numbers.pl#!/usr/bin/perl#sort_numbers.plopen(INFO, "records_file.txt"); # Open db for reading and display@array=<INFO>;close (INFO);print "Content-type:text/html\n\n"; #Follow with blank lineprint "<html>\n";print "<head><title></title></head>\n";print "<body>\n";print "<h4>Sorted by Number</h4>\n";foreach $line(sort byNUM @array){chomp($line);($last,$first,$record)=split(/\|/,$line);print "$record $first $last<br>\n";}print "</body>\n";print "</html>\n";#Sorting Subroutinesub byNUM {@a=split(/\|/,$a);@b=split(/\|/,$b);$a[2] <=> $b[2];}records_file.txtBunyan|Paul|3SimpSon|Bart|12Anderson|Pamela|22Bush|George|1
Note: If the scripts don't work: |
Create a Website with CMS
|
| Net Success 2000 Plus Inc PO Box 1508 Somerset, KY 42502 Copyright 2000 - 2007 Net Success 2000 Plus Inc Last Modified: January 16, 2008 |