sub is_perfect_square { my $sqrt = int(sqrt($_[0])); return $sqrt * $sqrt == $_[0]; }