Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-28 Thread David Precious
On Fri, 17 Jun 2016 14:33:12 -0700 Kenneth Wolcott wrote: > Hi; > > I'm having trouble understanding the built-in Perl sort with regards > to mixed numbers and strings > > I'm looking at http://perldoc.perl.org/functions/sort.html > > I have a

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-20 Thread Kenneth Wolcott
compare" routine uses $a and $b which are "special" to perl >> sort routines. >> Also the compare routine is written for obviousness rather than for brevity >> or elegance. >> >> The return from compare illustrates Shalomi Fish's point about usi

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-20 Thread Shlomi Fish
Hi Chris, On Mon, 20 Jun 2016 11:28:57 -0600 Chris Fedde wrote: > Kenneth, > > Below the cut is my example implementation as I understand your > requirements. > Note that the "compare" routine uses $a and $b which are "special" to perl > sort routines. >

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-20 Thread Chris Fedde
Kenneth, Below the cut is my example implementation as I understand your requirements. Note that the "compare" routine uses $a and $b which are "special" to perl sort routines. Also the compare routine is written for obviousness rather than for brevity or elegance. The

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-18 Thread Shlomi Fish
Hi Kenneth, On Fri, 17 Jun 2016 14:41:41 -0700 Kenneth Wolcott wrote: > On Fri, Jun 17, 2016 at 2:33 PM, Kenneth Wolcott > wrote: > > Hi; > > > > I'm having trouble understanding the built-in Perl sort with regards > > to mixed numbers and st

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-17 Thread Brock Wilcox
In this very particular case you should consider turning off the warning, maybe limiting it to the block. On Jun 17, 2016 5:42 PM, "Kenneth Wolcott" wrote: > On Fri, Jun 17, 2016 at 2:33 PM, Kenneth Wolcott > wrote: > > Hi; > > > > I'm having trouble un

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-17 Thread Jim Gibson
Wolcott wrote: > > On Fri, Jun 17, 2016 at 2:33 PM, Kenneth Wolcott > wrote: >> Hi; >> >> I'm having trouble understanding the built-in Perl sort with regards >> to mixed numbers and strings >> >> I'm looking at http://perldoc.perl.org/

Re: having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-17 Thread Kenneth Wolcott
On Fri, Jun 17, 2016 at 2:33 PM, Kenneth Wolcott wrote: > Hi; > > I'm having trouble understanding the built-in Perl sort with regards > to mixed numbers and strings > > I'm looking at http://perldoc.perl.org/functions/sort.html > > I have an array that I w

having trouble understanding the built-in Perl sort with regards to mixed numbers and strings

2016-06-17 Thread Kenneth Wolcott
Hi; I'm having trouble understanding the built-in Perl sort with regards to mixed numbers and strings I'm looking at http://perldoc.perl.org/functions/sort.html I have an array that I want to have sorted numerically and descending. The array is composed of elements that loo

Re: Perl sort for reverse numeric if numbers and text are in a string, numbers first

2016-03-09 Thread Brock Wilcox
g to a number using a thing from Scalar::Util. References: http://perlmaven.com/argument-isnt-numeric-in-numeric http://perlmaven.com/automatic-value-conversion-or-casting-in-perl --Brock On Tue, Mar 8, 2016 at 4:29 PM, Kenneth Wolcott wrote: > Hi; > > How do I call the built-in Perl so

Re: Perl sort for reverse numeric if numbers and text are in a string, numbers first

2016-03-08 Thread Shawn H Corey
On Tue, 8 Mar 2016 13:29:40 -0800 Kenneth Wolcott wrote: > How do I call the built-in Perl sort function on an array of strings > where the string is composed of one or more digits, followed by a tab > which is followed by a string and I want the results to be sorted in > reverse n

Re: Perl sort for reverse numeric if numbers and text are in a string, numbers first

2016-03-08 Thread Andrew Solomon
> Hi; > > How do I call the built-in Perl sort function on an array of strings > where the string is composed of one or more digits, followed by a tab > which is followed by a string and I want the results to be sorted in > reverse numeric order? > > I looked at http

Perl sort for reverse numeric if numbers and text are in a string, numbers first

2016-03-08 Thread Kenneth Wolcott
Hi; How do I call the built-in Perl sort function on an array of strings where the string is composed of one or more digits, followed by a tab which is followed by a string and I want the results to be sorted in reverse numeric order? I looked at http://perldoc.perl.org/functions/sort.html

Re: perl sort

2009-02-07 Thread Raymond Wan
Hi all, Chas. Owens wrote: Well, I would suggest taking this to the Perl Porters list*, this is a list for people who are starting to learn Perl. You could also write a module implementing you algorithm either in pure Perl or in XS** (the interface between ISO C and Perl) and upload it to CPAN

Re: perl sort

2009-02-07 Thread Chas. Owens
On Sat, Feb 7, 2009 at 22:41, Marion McCoskey wrote: > I am a retired programmer, and I haven't had a lot of trouble with the > couple of thousand lines of Perl I have written, except remembering to > always put in curly braces. But I don't know anything about the Perl > community. > > While look

Re: perl sort

2009-02-07 Thread Raymond Wan
Hi Marion, Marion McCoskey wrote: While looking at the documentation for the sort function, I noticed it complaining about the shortcomings of the quick sort. I share that feeling and I have developed a single-buffered count sort that is faster than the quick sort and a lot more stable. Act

perl sort

2009-02-07 Thread Marion McCoskey
I am a retired programmer, and I haven't had a lot of trouble with the couple of thousand lines of Perl I have written, except remembering to always put in curly braces. But I don't know anything about the Perl community. While looking at the documentation for the sort function, I noticed it comp

Re: perl sort query

2007-06-19 Thread Rob Dixon
pauld wrote: John W. Krahn wrote: It sorts fine here: $ perl -le' print for @x = qw/200610011733 200610012057 200610011029 200610010928 200610011220/, ""; print for sort @x; ' 200610011733 200610012057 200610011029 200610010928 200610011220 200610010928 200610011029 200610011220 2006100117

Re: perl sort query

2007-06-19 Thread pauld
> $ perl -le' > print for @x = qw/200610011733 200610012057 200610011029 200610010928 > 200610011220/, ""; > > print for sort @x; > ' > 200610011733 > 200610012057 > 200610011029 > 200610010928 > 200610011220 > the time is the last 4 digits (hhmm) so the first is 17:33 then 20:57 then 10:29 then

Re: perl sort query

2007-06-18 Thread John W. Krahn
pauld wrote: I want to sort a hash of hash by date&time and then extract some of the data. From the data ive got i can contruct a key that is mmddhhmm and i do this ##error trap absent entries if ($endan=~m/\d{2}:\d{2}\s+\d{2}/ && $stan=~m/\d{2}:\d{2}\s+\d{2}/ ) {my %daylist; #

perl sort query

2007-06-18 Thread pauld
I want to sort a hash of hash by date&time and then extract some of the data. >From the data ive got i can contruct a key that is mmddhhmm and i do this ##error trap absent entries if ($endan=~m/\d{2}:\d{2}\s+\d{2}/ && $stan=~m/\d{2}:\d{2}\s+\d{2}/ ) {my %daylist; ##split start and