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

Fun with Perl, for a change

Thread Previous | Thread Next
From:
Simon Cozens
Date:
April 10, 2003 08:47
Subject:
Fun with Perl, for a change
Message ID:
20030410154719.GA2201@deep-dark-truthful-mirror.pad
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::/ww.domain.com/path/path/name
> [... 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
fun.

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

    use Ruby;

    $x = 10; 
    print $x;                        # 10
    $x++; 
    $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
Perl.

-- 
<quidity> Sometimes it's better not to pedant.

Thread Previous | Thread Next


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