logo       

RE: Fun - Each character at most once: msg#00056

Subject: RE: Fun - Each character at most once
> 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. This had a
sort of "quine"y feel to it and hence could be "interesting"(tm).
Unfortunately I was stumped, the best I can do is check the first line of
the file from @ARGV. 

print <>=~m{(.)[^$/]*\1}

This is not what I'd hoped for when I started, but "print" kills so many
other useful tools, while, for, grep, map, until, if, unless, or, and.  All
the /[a-z]+/ flow-control-like functions remaining to you are "do" and
"eval".  Also it's far too easy to use up the 4 legal parens (), {} [] and
<>.  The only other printing method I can easily see is via a "!#perl -p"
line which is illegal (I presume).

Can anyone improve the above so that it checks the whole of <>, not just one
line? Bonus points for an explicit multi-character message rather than undef
on failure. 

Alistair


-----------------------------------------------------------------------


Registered Office:
Marks & Spencer p.l.c
Michael House, Baker Street,
London, W1U 8EP
Registered No. 214436 in England and Wales.

Telephone (020) 7935 4422 
Facsimile (020) 7487 2670

www.marksandspencer.com

Please note that electronic mail may be monitored.

This e-mail is confidential. If you received it by mistake, please let us know 
and then delete it from your system; you should not copy, disclose, or 
distribute its contents to anyone nor act in reliance on this e-mail, as this 
is prohibited and may be unlawful.

The registered office of Marks and Spencer Financial Services PLC, Marks and 
Spencer Unit Trust Management Limited, Marks and Spencer Life Assurance Limited 
and Marks and Spencer Savings and Investments Limited is Kings Meadow, Chester, 
CH99 9FB. These firms are authorised and regulated by the Financial Services 
Authority. 




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe