|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
I'm writing a script for myself  I'm using this code in a sub. This code prints 53 times (because there are 53 file to open). But how can I sort the code alphabetically? for example I have a.cgi b.cgi c.cgi d.cgi to open and want to sort them alphabetically with the $isim variable if b.cgi has $isim beginning with letter "a" print it first, then other and other... HOW? [ February 07, 2001: Message edited by: jeologic ]
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
$isim is the first bit of data in each record, so no need to do anything special.
Just add the 'sort' command to your foreach
foreach $i (sort @data) {
etc
Of course, I could be misunderstanding what you're asking. If so, please provide more detail.
--mark
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Feb 2000
Posts: 4,625
Member
|
Member
Joined: Feb 2000
Posts: 4,625 |
*cough* He's asking for things to be printed in ABC(c) order.
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
And what did I answer? Perhaps we need more explanation/clarification of what's what.
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Feb 2000
Posts: 4,625
Member
|
Member
Joined: Feb 2000
Posts: 4,625 |
No, i was just confirming what you heard.
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
quote:</font><HR> $isim is the first bit of data in each record, so no need to do anything special. Just add the 'sort' command to your foreach foreach $i (sort @data) { etc <HR></BLOCKQUOTE>
I tried to put sort command into foreach bu it didnt work it still prints randomly... well some of them sorting but not all of them. I didnt find the solution...
btw, $isim includes non-english characters in some files. But only one of them has a non-english character as the first letter... can that be a prob?
here is the complete sub;
<BLOCKQUOTE><font size="1" face="Verdana, Helvetica, Arial">code: [ February 08, 2001: Message edited by: jeologic ]
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 417
Joined: November 2001
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|