Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Don't forget that 99 Problems in Perl 6 [oreillynet.com] is still in the pugs repository. One neat solution which is a bit tricky in other languages is the "lotto" problem (Draw N different random numbers from the set 1..M). This was my try at a solution for the actual lotto function:

    subset Positive::Int of Int where { $_ > 0 };

    sub lotto (Positive::Int $count, Positive::Int $range) returns List {
        return (1 .. $range).pick($count);
    }

    Many of the problems in the repository were solved sub-optimally due to the state of pugs, so there's plenty of room to play.