develooper Front page | perl.fwp | Postings from July 2003

Re: Fun - Each character at most once

Thread Previous | Thread Next
From:
A. Pagaltzis
Date:
July 17, 2003 14:49
Subject:
Re: Fun - Each character at most once
Message ID:
20030717214851.GA2660@klangraum
* Alistair.McGlinchy@marks-and-spencer.com <Alistair.McGlinchy@marks-and-spencer.com> [2003-07-17 21:15]:
> > What is the most "interesting" program that is restricted to
> > use each ASCII character at most once?
> 
> The definition I chose was to check if a program (from @ARGV)
> contains duplicate chars and  printing a duplicate char iff it
> has one.

Even ++, --, ==, && etc are illegal. A substitution based
approach is about impossible - you need a dot in several places
of the pattern, and if you have backreference you'll likely need
a capture variable with the same number in the replacement
expression as well. And finally, you can't refer to any variable
more than once.

That final one is the kicker.

Basically, with all ASCII characters used at most once, you can't
really write anything that needs to actually operate on data in
any more but the most trivial ways.

-- 
Regards,
Aristotle

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