Add code, pod and tests for CyclicRotation
This commit is contained in:
parent
51afbeae72
commit
019657c95a
6 changed files with 173 additions and 5 deletions
39
2-cyclic_rotation.pl
Executable file
39
2-cyclic_rotation.pl
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use FindBin;
|
||||
use lib "$FindBin::RealBin/lib";
|
||||
use lib 'lib';
|
||||
use CyclicRotation;
|
||||
|
||||
|
||||
my $array_ref, $shift_int = @ARGV;
|
||||
if (scalar(@ARGV) != 2) {
|
||||
die "Usage: $0 \$array_ref \$integer\n";
|
||||
}
|
||||
|
||||
my $answer = CyclicRotation::solution(@ARGV);
|
||||
print "The rotated array ref is\n";
|
||||
print Dumper($answer);
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=encoding utf8
|
||||
|
||||
=head1 NAME
|
||||
|
||||
cyclic_rotation.pl - Given an array reference $A and integer $K rotate the array A a number of times specified by K.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
cyclic_rotation.pl $array_ref $integer
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This script is used to exercise CyclicRotation.pm. It takes one array ref and one integer as input. It returns the array ref rotated the amount of times indicated by the integer.
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue