CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
sorting and order

 



dave_deejay
Deleted

Jun 12, 2001, 2:16 AM

Post #1 of 2 (542 views)
sorting and order Can't Post

i have a script that takes a txt file and diplays it as a page with header and footer

the txt file is a list of discos in and around france...
what i would like to do is for the to come out in a sorted order.
i have added | in the field where i wanted it to be sorted by and |\n to finish record

is this possible or is it a bit far fetched

thanks once again

davidd sargent



randor
User

Jun 12, 2001, 4:17 AM

Post #2 of 2 (540 views)
Re: sorting and order [In reply to] Can't Post

dave_deejay,

is this what you are looking for?

#!/usr/bin/perl

$discos = "groovydisco|discotech|discofever";

@yourchoices = split(/\|/, $discos);
@yourchoices = sort @yourchoices;

foreach $tech (@yourchoices) {
print "$tech\n";
}

I Hope this helps...

perl programmers don't die.. they just start writing a new script.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives