develooper Front page | perl.golf | Postings from August 2002

Re: First posts of some famous golfers

Thread Previous | Thread Next
From:
Andrew.Savige
Date:
August 27, 2002 22:19
Subject:
Re: First posts of some famous golfers
Message ID:
694BB7191495D51183A9005004C0B05452DF4D@ir-exchange-srv.ir.com.au
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

/-\

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About