- or download this
use strict;
use warnings;
...
print 'x of 2 = ',$x->of(2),"\n";
print 'ref of x of 2: ', ref $x->of(2),"\n";
print "x of 2 is three!\n" if ($x->of(2) == 3);
- or download this
x = (1, 3, 2, 4)
x of 2 = 3
ref of x of 2:
- or download this
sub of {
my $x = shift;
...
return map { ($_<$$x{'n'}) ? $$x{'perm'}[$_] + 1 : $_+1 } @y;
}
- or download this
sub new {
# SNIP
...
bless \%x, $class;
}