En op 28 augustus 2002 sprak Sec:
> Finding (and printing) all words (from stdin) with all of a set
> of given letters (on the command line, for simplicity) appearing
> once in the first 10 characters of the word, and containing no
> duplicates in the first 10 characters.

Some examples would make this specification clearer.
Does the following example match the specification?

z.pl:
#!perl -n
BEGIN{$x=pop}
length($x)-(@z=substr($_,0,10)=~/[$x]/g)||print

When I run:
  perl z.pl ab <t.txt
where t.txt contains:

abcdefghijklmnopqrst
abc
xyz
abcabc
abcdefxyzdabc
abcdefxyzabc

it prints:

abcdefghijklmnopqrst
abc
abcdefxyzdabc

/-\

Reply via email to