#!/usr/bin/env perl
while(my $line = <>) {
my %unique;
my $size = grep { !$unique{$_}++ } split //, $line;
print "$line" if length($line) == $size;
}
If you would prefer to show lines that have one character difference, you can replace the print statement with this:
my $ok = 0;This will permit "aabc" and "abca" as well as "aabb" and the like. It should be easy for someone to figure out from there ;)
foreach my $current (keys %unique) {
if ( $unique{$current} > 2 ) { $ok = 1; }
}
print "$line" if $ok == 0;

3 comments:
Advice for others:
To run script 10% faster try Speedy. So on ubuntu(or any Backtrack) system type:
apt-get install speedy-cgi-perl
and change first line to;
#!/usr/bin/speedy
On i7 system can run 5 proccess same time to speedup work.
The fuck!?
What part of the script looks like it runs CGI under a web server??
Real advice: Ignore previous advice.
Maybe you are right, but it works and do same job. and its faster.
so sorry if any...
Post a Comment