Geeks Talk

Prepare for your Next Interview




Unsorted array of strings

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. ...


Go Back   Geeks Talk > Web Development > PERL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-14-2008
Junior Member
 
Join Date: Jan 2008
Location: Singapore
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
heidi012979 is on a distinguished road
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.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-24-2008
Junior Member
 
Join Date: Jan 2008
Location: India
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
realnapster is on a distinguished road
Re: Unsorted array of strings

Show some effort man. You will surely get some help.
Reply With Quote
  #3 (permalink)  
Old 02-06-2008
Junior Member
 
Join Date: Oct 2007
Location: India
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
amitbhosale is on a distinguished road
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 arrayn go must Show World hello
Reply With Quote
Reply

  Geeks Talk > Web Development > PERL


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 09:26 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved