[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] print thyself [golf]



Clifford

> Try using $0 in a perl -e'...' and it won't work. (Plus you might not have

> a file system...)

I don't use -e at all because NT4.0 doesn't do one liners properly. For
example:

D:\>perl -le'$_=q(print "\$_=q($_);eval");eval'
Can't find string terminator "'" anywhere before EOF at -e line 1.

Having thought about how to do this without $0, I realise how clever this
is. I can't improve apon your colleagues' code yet, but how about this for a
cute piece of input=output when saved as test.pl
--<SNIP>------------------------------------------------------------
D:\>type test.pl
syntax error at test.pl line 2, at EOF
Execution of test.pl aborted due to compilation errors.

D:\>perl test.pl
syntax error at test.pl line 2, at EOF
Execution of test.pl aborted due to compilation errors.

D:\>
--<SNIP>------------------------------------------------------------

Alistair

__________________________________________________________________________________________

Registered Office:
Marks and Spencer plc
Michael House, Baker Street,
London, W1A 1DN
Registered No. 214436 in England and Wales.

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

www.marks-and-spencer.com

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.
___________________________________________________________________________________________

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe