Loading ...
Sorry, an error occurred while loading the content.
 

Re: [Clip] sorting an array ... how to?

Expand Messages
  • Alan C
    Just curious if underscores instead of colon would make it sort any differently. Isn t there a numsort in the clip lingo to sort a doc? Perl has 2 different
    Message 1 of 2 , Jun 27, 2009
      Just curious if underscores instead of colon would make it sort any
      differently.

      Isn't there a numsort in the clip lingo to sort a doc?

      Perl has 2 different sorts -- alpha and also a numeric sort.

      #!/usr/bin/perl -w
      use strict;
      if ( /Perl_on_board/ ) {
      print "Perl's numeric sort likely would do it \n";
      else
      print "Perl_not_found_on_sys \n";
      }
      __END__

      On Sat, Jun 27, 2009 at 9:46 PM, Don - HtmlFixIt.com <don@...>wrote:

      > I have an array ... with semi-colon as the delimiter ... but I want to
      > sort it on the first sub-element of each array ... before the colon
      >
      > Here is my array ...
      >
      > 1:3:4:Place;5:26:31:Name;34:22:56:Grade;31:2:33:School;56:8:64:Time
      >
      > Do I need to put it one array element on each line and then use strsort?
      >
      > If I put on lines and just sort I get ...
      > 1:3:4:Place
      > 31:2:33:School
      > 34:22:56:Grade
      > 5:26:31:Name
      > 56:8:64:Time
      >
      > Not what I want because 5 comes after 56.
      >
      > Proper order is thus:
      > 1:3:4:Place
      > 5:26:31:Name
      > 31:2:33:School
      > 34:22:56:Grade
      > 56:8:64:Time
      >
      > I suppose I could pad my first elements ... with zero's ... if I had to ...
      > 01:3:4:Place
      > 05:26:31:Name
      > 31:2:33:School
      > 34:22:56:Grade
      > 56:8:64:Time
      >
      > but then I suspect I'll need to strip those out later again ... and I
      > need to do math ... is 05-4=1 in calc function?
      >
      > Is 05>4 in and if statement?
      >
      > If I did a regex .{05} would it work?


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.