Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Numerical sort (Schwartzian xform)

Reply
Thread Tools

Numerical sort (Schwartzian xform)

 
 
Jorge
Guest
Posts: n/a
 
      09-06-2006
I'm running ActiveState perl 5.8.8 on XP

While working on my dog racing program, I build an array containing
these strings which are numerically indexed 1 thru 8 by the last
column.

31.43 32 1005.89 Figs Domino 1
31.62 17 537.57 Boc's Skater 2
31.85 18 573.34 Reward Crystal 3
31.54 27 851.47 Db Miss Buxley 4
31.78 13 413.17 Ucme Lola 5
31.96 12 383.46 Bayou Jasmine 6
31.62 14 442.62 Y's Flirt 7
31.46 30 943.88 Sheriff Wade 8

I pass the array to my schwartzian transform sub routine using this
call ...

my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);

with expectations of it returning an array that is sorted on the
numerical 1st column (2-place floats) but it always returns the
original array. I couldn't find anything in perlfaq4 that explains this
nor could I find anything on the web that explained it in terms I could
understand, notwithstanding the tonnes of articles about Perl sorting.

Can anyone give me an idea how to get the desired behaviour on this?
Your help is greatly appreciated - TIA.

Here is my SchwartzianTransform sub routine:

sub SchwartzianTransform{
my ($sep, $cols);
if (ref $_[0]) {
$sep = '\\s+'
} else {
$sep = shift;
}
unless (ref($cols = shift) eq 'ARRAY') {
die "fieldsort columns must be in anon array";
}
my (@sortcode, @col);
my $col = 1;
for (@$cols) {
my ($a, $b) = /^-/ ? qw(b a) : qw(a b);
my $op = /n$/ ? '<=>' : 'cmp';
push @col, (/(\d+)/)[0] - 1;
push @sortcode, "\$${a}->[$col] $op \$${b}->[$col]";
$col++;
}
my $sortfunc = eval "sub { " . join (" or ", @sortcode) . " } ";
my $splitfunc = eval 'sub { (split /$sep/o, $_)[@col] } ';
return
map $_->[0],
sort { $sortfunc->() }
map [$_, $splitfunc->($_)],
@_;
}

 
Reply With Quote
 
 
 
 
usenet@DavidFilmer.com
Guest
Posts: n/a
 
      09-06-2006
Jorge wrote:
> my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
>
> with expectations of it returning an array that is sorted on the
> numerical 1st column (2-place floats)


waitaminute - you want to sort an array on the first column? Why not
just sort the array:
sort @array

If your data is consistent (^\d\d\.\d\d) this is all you need to do.

--
David Filmer (http//DavidFilmer.com)

 
Reply With Quote
 
 
 
 
Ala Qumsieh
Guest
Posts: n/a
 
      09-06-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Jorge wrote:
>> my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
>>
>> with expectations of it returning an array that is sorted on the
>> numerical 1st column (2-place floats)

>
> waitaminute - you want to sort an array on the first column? Why not
> just sort the array:
> sort @array
>
> If your data is consistent (^\d\d\.\d\d) this is all you need to do.


It is safer to not make such an assumption, and the solution isn't much more
complicated anyway:

sort {$a <=> $b} @array;

--Ala

 
Reply With Quote
 
Jorge
Guest
Posts: n/a
 
      09-06-2006
A straight sort was my first attempt ...

@sorted_array = sort @array;

foreach $line(@sorted_array){print "$line";}

and it produces the original unsorted array so I thought possibly the
problem had something to do with how sorting works (ascii, alpha,
numerical, lexical, whatever) and that I had to point it to the first
column and ask for a numerical sort ... hence my attempt at the
schwartzian transform.

(E-Mail Removed) wrote:
> Jorge wrote:
> > my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
> >
> > with expectations of it returning an array that is sorted on the
> > numerical 1st column (2-place floats)

>
> waitaminute - you want to sort an array on the first column? Why not
> just sort the array:
> sort @array
>
> If your data is consistent (^\d\d\.\d\d) this is all you need to do.
>
> --
> David Filmer (http//DavidFilmer.com)


 
Reply With Quote
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      09-06-2006
Jorge <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> I'm running ActiveState perl 5.8.8 on XP
>
> While working on my dog racing program, I build an array containing
> these strings which are numerically indexed 1 thru 8 by the last
> column.
>
> 31.43 32 1005.89 Figs Domino 1
> 31.62 17 537.57 Boc's Skater 2
> 31.85 18 573.34 Reward Crystal 3
> 31.54 27 851.47 Db Miss Buxley 4
> 31.78 13 413.17 Ucme Lola 5
> 31.96 12 383.46 Bayou Jasmine 6
> 31.62 14 442.62 Y's Flirt 7
> 31.46 30 943.88 Sheriff Wade 8
>
> I pass the array to my schwartzian transform sub routine using this
> call ...
>
> my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
>
> with expectations of it returning an array that is sorted on the
> numerical 1st column (2-place floats) but it always returns the
> original array.


For me it returns the sorted array. Show a complete, runnable
program that shows the behavior you are seeing.

Anno
 
Reply With Quote
 
Jorge
Guest
Posts: n/a
 
      09-06-2006
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de wrote:
> Jorge <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > I'm running ActiveState perl 5.8.8 on XP
> >
> > While working on my dog racing program, I build an array containing
> > these strings which are numerically indexed 1 thru 8 by the last
> > column.
> >
> > 31.43 32 1005.89 Figs Domino 1
> > 31.62 17 537.57 Boc's Skater 2
> > 31.85 18 573.34 Reward Crystal 3
> > 31.54 27 851.47 Db Miss Buxley 4
> > 31.78 13 413.17 Ucme Lola 5
> > 31.96 12 383.46 Bayou Jasmine 6
> > 31.62 14 442.62 Y's Flirt 7
> > 31.46 30 943.88 Sheriff Wade 8
> >
> > I pass the array to my schwartzian transform sub routine using this
> > call ...
> >
> > my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
> >
> > with expectations of it returning an array that is sorted on the
> > numerical 1st column (2-place floats) but it always returns the
> > original array.

>
> For me it returns the sorted array. Show a complete, runnable
> program that shows the behavior you are seeing.
>
> Anno


Here is the program which requires a dedicated directory named
c:\dogs\tonight which contains the data file (at the end of the post --
truncated to save bandwidth).

snip<------ program starts here ------>snip

#!perl -lw

use warnings;
use strict;
use File:ath;

&createIndividualDogsFiles("c:\\dogs\\tonight") ;

sub createIndividualDogsFiles{
my(@filesArr, $filesArr, $dir, $path, $total, $totalCnt, $avg);
my($phx, $day, $mon, $dat, $yr, $matEve, $Race, $raceNum, $Grade);
my($gradeLet, $Dist, $distNum, $race, $numOfRaces, $racesAdded, $ans);
my($vaultFile, $raceArr, $dogName, $todaysPostNum, $finalTime,
$field1);
my $flag = 0;
my @resultsArr = ();
my $weight;
my $pp;
my($junk1, $junk2, $junk3);
my(@array, $array, $string, @sorted_array, $line);

$dir = shift;
unless (opendir(DIR, $dir)) {
warn "Can't open $dir\n";
closedir(DIR);
return;
}
foreach (readdir(DIR)) {
next if $_ eq '.' || $_ eq '..';
$path = "$dir\\$_";
if (-d $path) { # a directory
&createIndividualDogsFiles($path);
} elsif ( -f _) { # a plain file
open(IN, "$path") || die "Can't open $path for read: $!";
while(<IN>){
next if /^\s*$/ || /______/ || /======/ || / Owner / || / Trn /;
s/\s+\Z//;
if($_ =~ /Rosnet\,/ && $_ =~ /Race [0-9]/){
($junk1, $junk2, $junk3, $phx, $day, $mon, $dat, $yr, $matEve,
$Race,
$raceNum, $Grade, $gradeLet, $Dist, $distNum) = split(' ', $_,
14);
$race = "$Race"."_"."$raceNum"."_"."$gradeLet";
print "\n$race\n================";
}
elsif($_ !~ /Rosnet\,/ && $_ =~ /Race [0-9]/){
($phx, $day, $mon, $dat, $yr, $matEve, $Race, $raceNum,
$Grade, $gradeLet, $Dist, $distNum) = split(' ', $_, 12);
$race = "$Race"."_"."$raceNum"."_"."$gradeLet";
print "\n$race\n================";
}
elsif($_ =~ /Ken / && $_ =~ / Grade /){
$total = 0; $totalCnt = 0; $avg = 0;
$todaysPostNum = substr($_, 0, 1);
$dogName = substr($_, 2, 1;
$vaultFile = "c:\\dogs\\vault\\$dogName";

open(VDOG, "$vaultFile") || die "Can't open $vaultFile for
reading: $!";
while(<VDOG>){
my @stats = split(' ', $_);
my $fraction = $stats[1];
$total += $fraction;
++$totalCnt;
}
close(VDOG);
if($totalCnt > 0){
$avg = $total / $totalCnt;
$string = sprintf("%.2f %-3s%-8s%-20s%-2s", $avg, $totalCnt,
$total, $dogName, $todaysPostNum);
push(@array, $string);
}else{
$string = "$todaysPostNum $dogName --- No Data ---";
push(@array, $string);
}
}
@sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);
foreach $line(@sorted_array){
print "$line";
}
@array = ();
@sorted_array = ();
}
close(IN);
}
}
closedir(DIR);
}

#================================
# SUBROUTINE SchwartzianTransform
#================================

sub SchwartzianTransform{
my ($sep, $cols);
if (ref $_[0]) {
$sep = '\\s+'
} else {
$sep = shift;
}
unless (ref($cols = shift) eq 'ARRAY') {
die "fieldsort columns must be in anon array";
}
my (@sortcode, @col);
my $col = 1;
for (@$cols) {
my ($a, $b) = /^-/ ? qw(b a) : qw(a b);
my $op = /n$/ ? '<=>' : 'cmp';
push @col, (/(\d+)/)[0] - 1;
push @sortcode, "\$${a}->[$col] $op \$${b}->[$col]";
$col++;
}
my $sortfunc = eval "sub { " . join (" or ", @sortcode) . " } ";
my $splitfunc = eval 'sub { (split /$sep/o, $_)[@col] } ';
return
map $_->[0],
sort { $sortfunc->() }
map [$_, $splitfunc->($_)],
@_;
}

__END__

snip<----- data file ------>snip

Rosnet,Inc - Greyhound RacingPhoenix Tuesday Sep
05 2006 Evening Race 1 Grade D Dist 550

1 Figs Domino Ken Olsker Kennel Corp PH 44 5 8 4
5 Hi Grade - A Lo Grade - D
Trn Tim Olsker PH 9 3 1 0
2 Best Time 30.85
Black M 6/5/2004 Courageous Nicky Figs Cher Owner Dick Figurilli

PH09-01-06E 03 550 F 31.07 77 5 2 2 3 3 5 31.44 05.30 D
Bumped 1st Turn GecMartin Gablicious Chsm'sIndy 8
PH08-27-06E 13 550 F 31.58 77 5 7 4 4 4 8 32.13 07.80 D
Evenly, Inside Rd'sQuenAn GlsRustler Boc'sAttid 8
PH08-21-06E 13 550 F 31.82 76 1 1 1 2 1 2 2 1 31.92 05.30 D
Outfinished, Inside WntsAndNed KmaDiesel RwardFrsty 8
PH08-15-06E 03 550 F 31.16 77 3 6 4 5 6 10 31.85 27.60 C
Wide In Stretches KayFrbidng UsGoldenRl PatCPayabl 8
PH08-09-06E 11 550 S 31.75 78 3 4 6 6 6 14 32.77 21.50 C
Bumped 1st Turn CstarDesrt He'sOnThRn Flea'sCuti 8
PH08-04-06E 15 550 F 30.81 77 7 5 4 4 6 14 31.79 12.30 C
Offstride Far Turn StatUSDarD Bc'sLilNck AngelcBaty 7
__________________________________________________ __________________________________________________ _____________________
2 Boc's Skater Ken Bret Pachello PH 18 1 1 2
5 Hi Grade - B Lo Grade - D
Trn Michael Robinette PH 0 0 0 0
0 Best Time 31.05
Brindle M 3/12/2003 Trojan Cruze Contradiction Owner Brad Boeckenstedt

PH09-01-06E 01 550 F 31.19 75 6 2 2 4 8 16 32.35 12.40 D
Bumped Homestretch Absolm KmaKatnamo TvDamndbck 8
PH08-28-06S 07 550 F 31.86 75 7 4 2 3 5 12 32.74 ----- SD
Faded Far Turn Rlm'sBrwsr Boc'sMvnOn CldwaterIr 6
PH08-24-06S 08 550 F 31.6 77 1 2 1 hd 1 3 5 31.96 ----- SD
Outfinished, Inside Kaynta DjaysBlstO Boc'sBluBy 6
PH06-26-06E 01 550 F 31.37 74 4 6 5 5 5 8 31.91 11.50 D
Never Prominent Rj'sAntiEm BcAllstar MaraTheSam 7
PH06-18-06E 09 550 F 31 74 3 1 5 7 7 14 32.03 19.30 D
Early Threat, Faded LowFlynRck RagingSurf FigsDomino 8
PH06-11-06E 03 550 F 30.77 74 3 2 5 7 8 28 32.74 10.30 D
Collided 1st Turn Rd'sUndo UsLateShow TuffyTitan 8
__________________________________________________ __________________________________________________ _____________________
3 Reward Crystal Ken Gloria Dorsey PH 20 4 1 1
1 Hi Grade - C Lo Grade - M
Trn Patrick Phillips 0 0 0 0
0 Best Time 30.94
Dark Brindle F 9/13/2004 Wigwam Hoss Hkw Pongacrystal Owner Dr. Carl
E. Ward
PH08-31-06E 09 550 F 31.06 59 4 4 5 7 8 10 31.78 10.20 D
Steady Fade KrazyAsKat AmfAdroit JupiterTym 8
PH08-27-06E 07 550 F 31.65 59 2 3 2 4 6 10 32.34 04.90 D
Steady Fade ThinkMore UcmeKimmi Auster 8
PH08-21-06E 03 550 F 31.66 60 7 3 2 6 7 11 32.44 04.40 D
Crowded Backstr & Fa Wayn'sBbyd KaycarDshr FgsSmallBs 8
PH08-17-06E 01 550 F 31.21 60 6 2 2 2 2 5 31.59 12.90 D
Chased Winner, Insid GpherChcks BcGeeHoney KmWhodoVoo 8
PH08-12-06E 13 550 F 31.15 59 6 5 5 6 8 12 32.04 10.90 C
Never A Threat GlsRedalrt RsSammy HeyKnocker 8
PH08-06-06E 15 550 S 31.54 59 8 2 2 2 4 9 32.15 22.70 C
Weakened Hmstrch, In CldwterThe FigsMona GrysSnKing 8
__________________________________________________ __________________________________________________ _____________________
4 Db Miss Buxley Ken Olsker Kennel Corp PH 35 1 8 5
9 Hi Grade - C Lo Grade - J
Trn Tim Olsker PH 60 5 8 5
7 Best Time 31.13
White Black Bd. F 7/6/2003 Craigie Glen Db Cinema Owner Duran Bros.

PH09-01-06E 17 550 F 31.38 54 1 1 5 4 4 10 32.11 05.20 C
Bumped 1st Turn FlthyMcNst DafodlDbrh SavvyLouis 8
PH08-27-06E 11 550 F 31.29 54 8 8 8 8 8 17 32.49 11.60 C
Bumped 1st Turn Kane'sRchl Brilntcrnr Rlm'sLardo 8
PH08-23-06E 11 550 F 31.62 54 6 2 2 3 4 6 32.06 05.30 C
Outfinished, Inside NatashaLyn I'llTwThen DafodlDbrh 8
PH08-19-06E 17 550 S 32.08 54 3 7 4 5 7 11 32.92 08.10 C
Some Fade CruzenWili Brilntcrnr NatashaLyn 8
PH08-14-06E 02 550 F 31.56 55 2 1 2 2 2 31.61 07.00 C
Almost Up, Inside RagingSurf BellaAwacs Brilntcrnr 8
PH08-09-06E 09 550 S 31.98 55 2 2 3 6 8 10 32.73 04.50 C
Early Threat, Faded BestBetsy Rd'sNabsco RagingSurf 8
__________________________________________________ __________________________________________________ _____________________
5 Ucme Lola Ken Fidel Or Silvia SambadePH 24 1 4 3
4 Hi Grade - C Lo Grade - J
Trn Willie Davis 0 0 0 0
0 Best Time 31.05
Red F 2/19/2004 Ww Night Rider Passion Plan Owner Sherry De Witt Or
Shelly Rangel
PH08-31-06E 05 550 F 31.4 61 2 6 5 5 6 13 32.37 04.50 D
Offstr 1st Tn - Blck StatUSJyze CldwatrKck HindSight 8
PH08-25-06E 01 550 F 31.45 61 3 7 8 7 8 19 32.84 05.90 D
Bumped 1st & Homestr OddMonica AcMyPrsasn IrskaRedMg 8
PH08-20-06E 09 550 F 31.6 60 5 7 4 3 2 4 31.89 *03.50 D
Offstride Early Beemr Maybemybnt Twistedmnt 8
PH08-15-06E 09 550 F 30.75 60 5 5 3 2 2 10 31.52 06.20 D
Next Best, Midtrack Cherryprsp Boc'sSnoke MoonMtCrky 8
PH08-09-06E 01 550 S 31.42 60 7 4 3 2 2 4 31.73 14.00 D
Followed The Pace, M WhiskeyWhs CajunVal SweetAzArz 7
PH08-05-06E 07 550 S 32.26 60 4 5 5 3 4 12 33.14 06.50 D
Bumped 1st Turn FgsArmstrn NotAzChocl Hj'sTyler 8
__________________________________________________ __________________________________________________ _____________________
6 Bayou Jasmine Ken George Fune PH 18 1 0 2
5 Hi Grade - D Lo Grade - J
Trn Dorothy Fune 0 0 0 0
0 Best Time 31.62
Brindle F 4/3/2004 Oshkosh Slammer Mesa Greatone Owner Van Strother

PH09-01-06E 07 550 F 31.25 58 5 8 5 5 5 7 31.76 15.50 D
Bumped 1st Turn Auster SherifWade FgsSmallBs 8
PH08-28-06E 11 550 F 31.36 57 2 7 8 8 8 13 32.32 42.90 D
Bumped 1st Turn UsValeyFrg SltaryChrg See URound 8
PH08-24-06E 07 550 F 30.9 57 1 7 8 7 7 20 32.35 07.80 D
Always Back GecHottie UsValeyFrg DutchLilAn 8
PH08-18-06E 03 550 F 31.26 58 5 8 6 6 4 9 31.88 05.30 D
Sht Off Erly - Frcd CstarTaran FgsDarkKal UcmeJoe 8
PH08-12-06E 05 550 F 31.62 57 5 6 4 2 1 1 31.62 15.40 J
Drove To Win, Midtra ChicagMcky UsLandRovr BcBillyBoy 8
PH08-03-06E 05 550 F 31.21 57 7 6 5 5 3 8 31.81 21.10 J
Bumped 1st Turn SpicyDream BubleGmFev KayCeeSasn 7
__________________________________________________ __________________________________________________ _____________________
7 Y's Flirt Ken Fidel Or Silvia SambadePH 18 3 1 2
2 Hi Grade - C Lo Grade - M
Trn Willie Davis 0 0 0 0
0 Best Time 31.03
Black M 7/4/2004 Oshkosh Slammer Tm's Merry Pace Owner Silvia Sambade

PH08-26-06E 07 550 F 31.81 74 6 5 6 6 6 10 32.51 08.70 D
Bumped 1st Turn Rd'sVictor Fla'sHiway IrskaMyrtl 8
PH08-17-06E 01 550 F 31.21 74 1 6 5 5 7 11 31.99 05.30 D
Offstride 1st & Far GpherChcks RwardCryst BcGeeHoney 8
PH08-11-06E 17 550 M 31.17 75 6 4 5 5 7 22 32.75 09.10 C
Crowded Far Turn ClSpeedie I'llTwThen Rd'sKates 7
PH08-07-06E 14 550 S 31.47 73 6 6 4 4 6 13 32.43 12.70 C
Late Fade SlitaryAsh GecHenry RewrdRedGr 7
PH08-03-06E 09 550 F 31.1 73 3 6 7 8 8 16 32.24 14.60 C
Bumped 1st Turn DtchDaniel RagingSurf RsSammy 8
PH07-29-06E 17 550 F 30.5 73 1 5 5 6 4 16 31.62 03.50 C
Varied Little, Insid AndrwsPstc UssVentura FigsIou 8
__________________________________________________ __________________________________________________ _____________________
8 Sheriff Wade Ken Lonnie Boyle PH 34 4 6 1
7 Hi Grade - B Lo Grade - D
Trn Jamie Boyle PH 18 1 3 4
5 Best Time 30.79
Black M 3/13/2004 Scorcher's Ace Dawn's Earlylite Owner Howard L.
Marshall
PH09-01-06E 07 550 F 31.25 76 2 2 2 2 2 2 31.38 07.70 D
Followed The Pace, I Auster FgsSmallBs UcmeKimmi 8
PH08-27-06E 01 550 F 31.73 77 7 8 8 8 8 10 32.42 21.50 D
Offstride 1st Turn LitlLisaLo HindSight IvansImage 8
PH08-22-06E 09 550 F 31.42 75 4 2 5 5 8 14 32.44 08.10 D
Dropped Back Early BcGeeHoney MoonMtBomr KmaKatnamo 8
PH08-17-06S 06 550 F 31.27 76 6 2 4 4 4 10 31.99 ----- SD
Slight Factor, Insid GecMartin Vl ColdwterDn 7
PH07-30-06E 13 550 F 30.99 76 1 3 5 5 5 7 31.52 03.40 D
Never Prominent FigsMona Insider'sG QalityChic 8
PH07-24-06E 01 550 F 31.02 77 4 6 5 4 4 6 31.45 03.40 D
Bumped At Break & Ea FgsconchCr CldwatrKck ImaKtyDdgr 8
__________________________________________________ __________________________________________________ _____________________
================================================== ================================================== =====================

 
Reply With Quote
 
Jorge
Guest
Posts: n/a
 
      09-06-2006
Addition to my previous post ...

The program also has a dependency on a library of data (vault
directory) which I built with another program and the library is simply
too large to post ... ~ 1600 files. The program will not successfully
run without the library.

 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      09-06-2006
"Jorge" <(E-Mail Removed)> wrote:

> Addition to my previous post ...
>
> The program also has a dependency on a library of data (vault
> directory) which I built with another program and the library is simply
> too large to post ... ~ 1600 files. The program will not successfully
> run without the library.


In which case it's a good idea to reduce your program to the smallest
version that shows your problem.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
 
Reply With Quote
 
Jorge
Guest
Posts: n/a
 
      09-06-2006
Good advice -- thank you ...

I pruned the program to this ...

#!perl -lw

use strict;

my(@array, @sorted, $line);

open(IN, "infile.txt") || die "Can't open infile for read: $!";
while(<IN>){
push(@array, $_);
}
close(IN);

@sorted = sort @array;

foreach $line(@sorted){
print "$line";
}

__END__

which reads this file ...

31.43 32 1005.89 Figs Domino 1
31.62 17 537.57 Boc's Skater 2
31.85 18 573.34 Reward Crystal 3
31.54 27 851.47 Db Miss Buxley 4
31.78 13 413.17 Ucme Lola 5
31.96 12 383.46 Bayou Jasmine 6
31.62 14 442.62 Y's Flirt 7
31.46 30 943.88 Sheriff Wade 8

to create the array and it indeed does sort properly jusing the
standard sort() function.

Obviously, when I create the array on the fly in the program, I am
somehow bringing to the surface something that precludes sorting (for
whatever reason) maybe it's a whitespace problem or a seperator problem
or ...

I'll dig around until I find it.

Thanks



John Bokma wrote:
> "Jorge" <(E-Mail Removed)> wrote:
>
> > Addition to my previous post ...
> >
> > The program also has a dependency on a library of data (vault
> > directory) which I built with another program and the library is simply
> > too large to post ... ~ 1600 files. The program will not successfully
> > run without the library.

>
> In which case it's a good idea to reduce your program to the smallest
> version that shows your problem.
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/


 
Reply With Quote
 
Randal L. Schwartz
Guest
Posts: n/a
 
      09-07-2006
>>>>> "Jorge" == Jorge <(E-Mail Removed)> writes:

Jorge> I pass the array to my schwartzian transform sub routine using this
Jorge> call ...

Jorge> my @sorted_array = &SchwartzianTransform(' ', ['1n', -1], @array);

You don't like Sort::Fields (in the CPAN) for some reason?

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<(E-Mail Removed)> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: When will Thunderbird support sort in place (in context sort)? Ron Natalie Firefox 0 02-02-2006 04:38 AM
The Colourised Bewitched -- sort of OK....... sort of! anthony DVD Video 26 06-28-2005 04:39 AM
xsl:sort lang="es" modern vs. tradidional Spanish sort order nobody XML 0 06-01-2004 06:25 AM
fast QListView numerical sort Uwe Mayer Python 2 02-12-2004 09:06 PM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM



Advertisments