use strict; my $string = shift; my %seen; map { my $temp = $string; substr $temp, $_, 1, ""; print "$temp\n" unless $seen{$temp}++; } (0..(length $string) - 1);