Hello Everyone, I am slightly confused...
I've got a Centos 6.3 Installation with its perl (version 5.10.1) and i am Using the Module List::MoreUtils which comes with the Linux Distribution. [root@bach perl-lib]# cd /tmp/ [root@bach tmp]# perl -MList::MoreUtils -MData::Dumper -wle 'print Dumper List::MoreUtils::minmax(1..4)' $VAR1 = 1; $VAR2 = 4; [root@bach tmp]# perl -MList::MoreUtils -MData::Dumper -wle 'print Dumper List::MoreUtils::minmax(1)' Use of uninitialized value in subroutine entry at -e line 1. $VAR1 = undef; $VAR2 = 1; So I looked at the Sources of MoreUtils.pm and checked the minmax function. (BTW: Its version 0.22 of the Module) -> http://pastebin.com/Y7BB0e45 the last part of the sub does something like if (@_ & 1), please correct me if i am worng but this checks if the number of elements in the list are odd? So for 1 element this is true. I was not sure wether this -1 in the Indexes died mess something up so i tried this: % perl my $min = 1; my $max = 1; @_ = (1); if ($_[$i-1] <= $_[$i]) { $min = $_[$i-1] if $min > $_[$i-1]; $max = $_[$i] if $max < $_[$i]; } else { $min = $_[$i] if $min > $_[$i]; $max = $_[$i-1] if $max < $_[$i-1]; } print $min; print "\n"; print $max; print "\n"; 1 1 On another Linux System everything works as expected. I would say that it is impossible that this sub returns just one value? So my question is why is that happening? Is there a bug somewhere? Is there maybe a C implementation of that, and if so how do i check for this? I also appreciate any hints regarding this issue. Cheers -Martin -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/