![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sort and Unique in Perl | deepakwins | Shell Programming and Scripting | 20 | 02-11-2008 09:25 PM |
| sort function in perl | DILEEP410 | Shell Programming and Scripting | 2 | 09-14-2007 09:03 AM |
| Perl find::file can I sort the out put | Andrek | Shell Programming and Scripting | 2 | 12-12-2006 01:19 AM |
| sort and uniq in perl | reggiej | Shell Programming and Scripting | 4 | 05-18-2006 11:46 PM |
| Sort file in perl | annececile | Shell Programming and Scripting | 4 | 06-21-2002 09:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
perl sort
Hi all, Say i have a array Code:
@array=("abc,"a",ab");
I would like to sort them according to the length. Any idea? thanks in advanced. i tried below code, but not work. Code:
sub sort_fun{
if (length shift(@_) >= length shift(@_) ){
return 1;
}
else{
return 0;
}
}
print join (", ",sort{sort_fun($a,$b)} ("abc","a","ab") ."\n";
|
![]() |
| Bookmarks |
| Tags |
| perl, perl shift, shift, shift perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|