On Tue, Oct 09, 2001 at 03:13:22PM -0500, Jonathan Scott Duff wrote:

> the following would be equivalent:
> 
>       $a = "foo\r\n";
>       print $a;               
>       print _$a;
>       print eval(repr($a));
> 
> That's probably a poor example of its utility, but I'm not as well
> versed in python to give repr() its due in a perl example.

        sub repr { my $str = shift; qq{"\Q$str\E"} }

or, Perl6ish:

        sub repr ($str) { qq{"\Q$str\E"} }

Dunno what it's useful for, but Perl's got it.

-- 
Aaron Sherman
[EMAIL PROTECTED]             finger [EMAIL PROTECTED] for GPG info. Fingerprint:
www.ajs.com/~ajs        6DC1 F67A B9FB 2FBA D04C  619E FC35 5713 2676 CEAF
  "Write your letters in the sand for the day I'll take your hand
   In the land that our grandchildren knew." -Queen/_'39_

Reply via email to