Prepare for your Next Interview
This is a discussion on Unsorted array of strings within the PERL forums, part of the Web Development category; Question on Unsorted Array? Help? You have unsorted array of strings, like: my @arr = qw(hello World Show must go on); Print this array, sorted in reversed case-insensitive order. ...
|
|||
|
Unsorted array of strings
Question on Unsorted Array? Help?
You have unsorted array of strings, like: my @arr = qw(hello World Show must go on); Print this array, sorted in reversed case-insensitive order. Guys Please help me solve this problem. Appreciate it. |
| Sponsored Links |
|
|||
|
Re: Unsorted array of strings
#!/usr/bin/perl
use strict; my @array=qw(hello World Show must go on); my $first_str; my $second_str; my @rev_sorted=reverse( sort { lc $second_str cmp lc $first_str } @array) ; print "\n Rev_Sorted array:@rev_sorted"; exit; Ans is : Rev_Sorted array n go must Show World hello |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| convert one dimansional array to two dimansional array | Geek_Guest | C and C++ | 6 | 12-22-2007 03:17 AM |
| static array or dynamic array? | rpgubba | C and C++ | 6 | 12-22-2007 03:03 AM |
| character array | pbchaudhari | C and C++ | 2 | 10-27-2007 03:41 AM |
| How DUAL diplays strings of length more than 1 | Geek_Guest | SQL | 2 | 08-10-2007 06:10 AM |
| How to split this entire row's contents into separate strings | JobHelper | SilkTest | 0 | 01-03-2007 04:32 PM |