Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Sorter

by damian1301 (Curate)
on Feb 24, 2001 at 09:59 UTC ( #60625=sourcecode: print w/ replies, xml ) Need Help??

Category: Text processing
Author/Contact Info drus3113@cs.com or just drus3113 on Compuserve, AOL, or AIM.
Description: This is the first script I have ever made, though it could use some improvements. This is about 2 months old out of my 5 month Perl career. Any improvements or suggestions will be, as usual, thankfully accepted.
 
#!/usr/bin/perl -wT
use CGI qw(:all);
use strict;

print header, start_html("Alphabetical sorter"), center(h2("Alphabetic
+al sorter"));


my $query = new CGI;
if ($query->param(1)) {
    foreach my $key (sort {lc(param($a)) cmp lc(param($b))} ($query->p
+aram)) {
        print "<STRONG>$key</STRONG> = ";
        my @values = $query->param($key);
        print join("",@values),"<BR>\n";
    }

}else{
    print start_form;
    print textfield({name=>$_,size=>'20'}),br for 1..5;
    print submit, end_form;
}

Comment on Sorter
Download Code
Replies are listed 'Best First'.
Re: Sorter (-wT and CGI::Carp)
by ybiC (Prior) on Feb 24, 2001 at 20:12 UTC
    Congratulation!! on your first code post, dude.   It runs clean for me (CGI.pm 2.752, Perl 5.00503, Debian 2.2r2)

    But you might consider adding -wT to the shebang line before someone unleashes the --hounds. {grin}   One other thought: perlman:CGI::Carp tells about using *cough* CGI::Carp, which is probably a good thing for most CGI scripts.
        cheers,
        Don
        striving for Perl Adept
        (it's pronounced "why-bick")

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://60625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2015-07-30 18:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls