sub fastolfe { my $source = shift; my $chop = shift; local($_); my %found; $found{$_}++ while ($_ = chop($source)) ne ''; while (($_ = chop($chop)) ne '') { return if --$found{$_} < 0; } my $result; foreach (sort keys %found) { $result .= $_ while $found{$_}--; } $result; }