Hi all,

I write a small script for permutation. When I use

version 1) Perl always complaint it although I get the

result. If I use version 2) it never says a word about

it. Any comments?

Thank you in advance,

Li

####version 1)###

use strict;

use warnings;

print permutation(5,2); # 5 choose 2

exit;

#subroutine permutation

sub permutation{

my ($n, $k)=@_;

my $result=1;

for ($k; $k>=1;$k--) {$result*=$n--;}#line 15

return $result;

}

#####screen output####

Useless use of private variable in void context at

fac1.pl line 15.

20

####version 2)###

use strict;

use warnings;

print permutation(5,2); # 5 choose 2

exit;

#######subroutine permutation##########

sub permutation{

my $n=shift;

my $result=1;

for (my $k=shift; $k>=1;$k--) {$result*=$n--;}

return $result;

}

###screen output####

20

__________________________________________________