http://www.perlmonks.org?node_id=1020812

supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerMonks,

I have come across a perl module i.e. Algorithm::Permute which can find out the permutations of r elements of n where r<n. I have installed the Algorithm from cpan writing the text on cmd as "cpan Algorithm::Permute" and then pressing "enter". I got the following results:

Results about Algorithm::Permute Installation: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\DR SUPRIYO>cpan Algorithm::Permute Set up gcc environment - 3.4.5 (mingw-vista special r3) Going to read 'C:\Perl\cpan\Metadata' Database was generated on Tue, 26 Feb 2013 12:07:54 GMT Algorithm::Permute is up to date (0.12).

Then I tried to run the script try5.pl (given below) in cmd several times but it gave the wrong results like:

Here goes the script try5.pl

#!/usr/bin/perl use warnings; use strict; use Algorithm::Permute; my @a=qw/ A B C /; # You can create r of n objects permutation generator, where r <= n my $p=new Algorithm::Permute(@a,2); while (@res = $p->next) { print join(", ", @res), "\n"; } exit; # Script ends here
RESULTS of try5.pl in cmd: C:\Users\DR SUPRIYO>cd desktop C:\Users\DR SUPRIYO\Desktop>try5.pl Can't locate loadable object for module Algorithm::Permute in @INC (@I +NC contain s: C:/Perl/site/lib C:/Perl/lib .) at C:\Users\DR SUPRIYO\Desktop\try5 +.pl line 4 Compilation failed in require at C:\Users\DR SUPRIYO\Desktop\try5.pl l +ine 4. BEGIN failed--compilation aborted at C:\Users\DR SUPRIYO\Desktop\try5. +pl line 4. C:\Users\DR SUPRIYO\Desktop>

BrowserUK suggested some code on 26 February 2013 but I find it very difficult to understand right from the beginning. I am little acuainted with #!/usr/bin/perl and not with others. That is why I am now trying with Algorithm::Permute module to solve the problem. I am looking forward to suggestions from PerlMonks to fix the problem of try5.pl in my computer.