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

RE: Fun - Each character at most once

From:
Alistair.McGlinchy
Date:
July 21, 2003 01:44
Subject:
RE: Fun - Each character at most once
Message ID:
2F8EDAE44C97B1488728682AC9602FC26CC754@MSHSREXCHGP0001
> Alistair.McGlinchy@marks-and-spencer.com schreef:
> > 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.
> 
> #!perl -0234
> <>=~m{(.)[^$/]*\1}sand&two> 
> contains no characters twice (except for the final \n), 
> checks the whole of <>, and prints a not-very-appropriate 
> message on failure.
> 
> Eugene

"and  printing a duplicate char iff it has one." You seem to have lost this
piece of functionality.  However, I like the error method of printing
allowing for the #!perl line. 

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. 




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