#!/usr/bin/env perl use strict; use warnings; use List::Util 1.45 'uniqstr'; use Test::More; my @tests = ( [abcdefa => 0], [abcdef => 1], [xyz => 1], [zzz => 0], ); plan tests => 0+@tests; for my $test (@tests) { my ($str, $exp) = @$test; is length($str) == uniqstr(split //, $str), !!$exp; }