ActiveState Perl 5.10 under Windows XP

Discussion in 'Perl Misc' started by dilbert1999@gmail.com, Dec 1, 2007.

  1. Guest

    Hi all,

    I have used Perl 5.8.8 for some time now, but I hope you don't mind if
    I post my first ever perl 5.10 program and ask for comments: (I just
    discovered that ActiveState have now released a Beta for Perl 5.10
    under Windows XP)

    C:\>perl -v

    This is perl, v5.10.0 built for MSWin32-x86-multi-thread
    (with 2 registered patches, see perl -V for more detail)

    Copyright 1987-2007, Larry Wall

    Binary build 1000 [283192] Beta provided by ActiveState http://www.ActiveState.com
    Built Nov 22 2007 14:37:48

    Here is my program :

    use strict;
    use warnings;
    use feature ':5.10';

    property($_) for (0, 1, 2, 3, 4, 'aad', 'abd', 'acd', 'add', 99, 100,
    101, 3.1415);

    sub property {
    my $foo = shift;
    printf 'my $foo = %-10s -- ', $foo;
    given ($foo) {
    when (1) { say "\$foo == 1" }
    when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
    when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
    when ($_ > 100) { say "\$foo > 100" }
    default { say "None of the above" }
    }
    }

    Any comments ?
    , Dec 1, 2007
    #1
    1. Advertising

  2. On Sat, 1 Dec 2007 09:16:28 -0800 (PST), wrote:

    >Here is my program :
    >
    >use strict;
    >use warnings;
    >use feature ':5.10';
    >
    >property($_) for (0, 1, 2, 3, 4, 'aad', 'abd', 'acd', 'add', 99, 100,
    >101, 3.1415);
    >
    >sub property {
    > my $foo = shift;
    > printf 'my $foo = %-10s -- ', $foo;
    > given ($foo) {
    > when (1) { say "\$foo == 1" }
    > when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
    > when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
    > when ($_ > 100) { say "\$foo > 100" }
    > default { say "None of the above" }
    > }
    >}
    >
    >Any comments ?


    It doesn't seem to have anything Windows or FWIW ActivePerl specific.
    Other than that, cool.


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Dec 1, 2007
    #2
    1. Advertising

  3. Ben Morrow Guest

    Quoth :
    > Hi all,
    >
    > I have used Perl 5.8.8 for some time now, but I hope you don't mind if
    > I post my first ever perl 5.10 program and ask for comments: (I just
    > discovered that ActiveState have now released a Beta for Perl 5.10
    > under Windows XP)
    >
    > Here is my program :
    >
    > use strict;
    > use warnings;
    > use feature ':5.10';
    >
    > property($_) for (0, 1, 2, 3, 4, 'aad', 'abd', 'acd', 'add', 99, 100,
    > 101, 3.1415);
    >
    > sub property {
    > my $foo = shift;


    For extra added 5.10-ness I might make that (totally untested)

    property for (...);

    sub property (_) {
    my $foo = shift;

    The new _ prototype character causes an argument to default to $_. :)

    > printf 'my $foo = %-10s -- ', $foo;
    > given ($foo) {
    > when (1) { say "\$foo == 1" }
    > when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
    > when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
    > when ($_ > 100) { say "\$foo > 100" }
    > default { say "None of the above" }


    Mmmm, /me likes. I can see given/when coming in very useful...

    Ben
    Ben Morrow, Dec 1, 2007
    #3
  4. Guest

    On Dec 1, 11:42 pm, Ben Morrow <> wrote:
    > For extra added 5.10-ness I might make that (totally untested)
    >
    > property for (...);
    >
    > sub property (_) {
    > my $foo = shift;
    >
    > The new _ prototype character causes an argument to default to $_. :)


    I *love* the new _ prototype character and I've tested it with perl
    5.10, works like a charm :))

    (the only alteration I had to make was to move the line "property for
    (...)" below the sub property(_) definition)
    , Dec 2, 2007
    #4
  5. On Sun, 2 Dec 2007 10:35:27 -0800 (PST), wrote:

    >(the only alteration I had to make was to move the line "property for
    >(...)" below the sub property(_) definition)


    Of course...


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Dec 2, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Caduceus
    Replies:
    1
    Views:
    2,079
    Joe Smith
    Sep 2, 2007
  2. Vittorio

    Boxed Perl or ActiveState Perl?

    Vittorio, Apr 1, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    178
    GreenLight
    Apr 2, 2004
  3. Jake Wiley
    Replies:
    14
    Views:
    287
  4. George
    Replies:
    6
    Views:
    334
    George
    Mar 5, 2006
  5. Dilbert
    Replies:
    0
    Views:
    831
    Dilbert
    Nov 10, 2011
Loading...

Share This Page