codility/2-cyclic_rotation.pl

39 lines
758 B
Perl
Raw Normal View History

#!/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.