At 10:07 PM 10/23/05, Jeff 'japhy' Pinyan wrote:
On Oct 23, Frank Bax said:
my $aval=''; map { $aval=$aval.sprintf("%4d",$aSuit{$a}{$_}); }
@f_seq;
my $aval=''; foreach $f (@f_seq) {
$aval=$aval.sprintf("%4d",$aSuit{$a}{$f}); }
You should be using $aval .= here, instead of $aval = $aval . .... And as
John has shown, join() is even better.
Right, but I wasn't able to integrate sprintf and join together (I've
figured it out since). This code (from John) runs in 115 seconds (map was
160, foreach was 195)!
my $format = '%4d' x @f_seq;
sprintf( $format, @{ $aSuit{ $a } }{ @f_seq } ) cmp sprintf( $format,
@{ $aSuit{ $b } }{ @f_seq } );
THANKS - It has syntax elements that are new to me - I would never have
come up with this on my own.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>