Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Perl6 Cookbook

by Ovid (Cardinal)
on Apr 10, 2005 at 20:02 UTC ( #446453=perlmeditation: print w/replies, xml ) Need Help??

As many of you know, Pugs now has an examples/cookbook directory. The PLEAC Project is about replicating the Perl Cookbook examples in as many programming languages as possible. Thus, examples/cookbook/ is about translating Perl5 to Perl6. This could be one of the most valuable resources for Perl programmers transitioning to the new language.

If you'd like to help, we can use it. If you have commit access to Pugs (liberally granted, I might add), then commit your own examples. If you don't think the current examples are good, feel free to update them with better examples (think "Subversion as wiki). This should be not only a translation guide, but a set of "best practices" for Perl6.

If you don't have commit access, you can always send me your recipes or simply post them here and I (or someone else) will port them over. If your recipe involves code that is not yet implemented in Pugs, that's OK! We're still happy to add it.

As usual, any thoughts or suggestions you have are welcome.

Update: the name was changed from examples/pleac/ to examples/cookbook/


New address of my CGI Course.

Replies are listed 'Best First'.
Re: Perl6 Cookbook
by Jaap (Curate) on Apr 11, 2005 at 07:25 UTC

      No, I don't believe so. Thanks for the catch! I or someone else will fix this.


      New address of my CGI Course.

Re: Perl6 Cookbook
by jdporter (Canon) on Oct 07, 2010 at 15:22 UTC

    Update: pugs is moribund, but the current Perl 6 development repo includes a collection of examples, including some implementations of the Cookbook recipes. Disappointingly, it is only accepting examples which actually work under the current standard-bearer implementation, Rakudo.

    PLEAC does not yet have a Perl 6 section, but it could.

    What is the sound of Windows? Is it not the sound of a wall upon which people have smashed their heads... all the way through?
Re: Perl6 Cookbook
by fishbot_v2 (Chaplain) on Apr 11, 2005 at 18:44 UTC

    Perhaps this is -too- idiomatic, but for recipe 04-08 (You want to find elements in one array but not in another):

    @aonly = gather { take when none(@b) for @a; };

    Though if when is considered a statement modifier in this case, and if you can't combine statement modifiers in p6 (much as you cannot in p5), then that likely doesn't work. In that case:

    @aonly = gather { for @a { take when none(@b) }};

    For numeric @a, and $_ will these be equivalent:

    ( $_ == none( @a ) ) && say "foo"; ( $_ ~~ none( @a ) ) && say "foo";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://446453]
Approved by Eyck
Front-paged by neniro
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2021-04-16 08:02 GMT
Find Nodes?
    Voting Booth?

    No recent polls found