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

Fun with Perl, for a change

Simon Cozens
April 10, 2003 08:47
Fun with Perl, for a change
Message ID:
Rob Dixon:
> Can somebody suggest how I might resolve the following?
> If I make a GET request to a server with a URL like
>     http::/
> [... ordinary programming question ...]

I must be on the wrong list. See, I thought this was fun-with-perl, and
boring programming questions just aren't fun. Even so, we've had nothing but
this sort of thing for the past two months or so. I suggest we have some more

Here's a piece of fun I came up with the other day. Who can work out how it

    use Ruby;

    $x = 10; 
    print $x;                        # 10
    $x.puts;                         # 11
    $x.class.puts;                   # Fixnum
    $x.class.class.puts;             # Class

    $x->upto(20, sub { $_.puts });   # 11, 12, 13, .. 20

    $y = "Hello, world";
    $y->puts;                        # Hello, world
    $y.class.puts;                   # String
    $y->length.puts;                 # 12

No source filters, XS or any other Deep Magic is involved. It's all pure

<quidity> Sometimes it's better not to pedant. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About