SPUG: sorting an array

Ryan Ames Ryan at e-valuations.com
Mon Jun 19 20:52:52 CDT 2000


thanks....

-----Original Message-----
From: Sanford Morton [mailto:smorton at pobox.com]
Sent: Monday, June 19, 2000 6:55 PM
To: Ryan Ames
Subject: SPUG: sorting an array


Ryan Ames writes:
 > I am kind of a newbie to perl and was wondering if there was a quick way
to
 > do a sort on an array of long ints.  
 > 
 > My array would look something like this.
 > 
 > 	@myArray = (123000, 122956, 239210, 128967, 543902, 209031, 333910);

Heheh, welcome to Perl, which makes easy things easy:

  @mySortedArray = sort @myArray;
  for (@mySortedArray) { print "$_ "}'
  ==> 122956 123000 128967 209031 239210 333910 543902


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list