Z
Zbigniew Fiedorowicz
I've run into problem in using sort under Perl 5.8.0 running under the
Linux Redhat 9.0 distribution. The code works flawlessly under Perl
5.6.0 under Linux Redhat 7.2. Under 5.8.0/RH 9.0 sorting fails with
error messages of the form:
Use of uninitialized value in numeric comparison (<=>) at (eval 2)
I'd be particularly interested in hearing whether this code works under
Perl 5.8.0 under other operating systems.
Here's the code:
----------- cut here ----------------------
#!/usr/bin/perl -w
use strict;
use Safe;
sub PGsort {
local($a,$b);
my $compare = shift;
sort {&$compare($a, $b) } @_;
}
my $cmp = new Safe;
print "Safe version $Safe::VERSION\n";
$cmp->share('&PGsort');
my $string = <<'EOF';
my @list = (4,6,2, 5 ,10, 8, 9 );
my $str = join( " ", PGsort sub {$_[0] <=> $_[1] } , @list );
print $str;
EOF
$cmp->reval($string);
----------- cut here ----------------------
Thanks in advance,
Zbigniew Fiedorowicz
Linux Redhat 9.0 distribution. The code works flawlessly under Perl
5.6.0 under Linux Redhat 7.2. Under 5.8.0/RH 9.0 sorting fails with
error messages of the form:
Use of uninitialized value in numeric comparison (<=>) at (eval 2)
I'd be particularly interested in hearing whether this code works under
Perl 5.8.0 under other operating systems.
Here's the code:
----------- cut here ----------------------
#!/usr/bin/perl -w
use strict;
use Safe;
sub PGsort {
local($a,$b);
my $compare = shift;
sort {&$compare($a, $b) } @_;
}
my $cmp = new Safe;
print "Safe version $Safe::VERSION\n";
$cmp->share('&PGsort');
my $string = <<'EOF';
my @list = (4,6,2, 5 ,10, 8, 9 );
my $str = join( " ", PGsort sub {$_[0] <=> $_[1] } , @list );
print $str;
EOF
$cmp->reval($string);
----------- cut here ----------------------
Thanks in advance,
Zbigniew Fiedorowicz