Slash Boxes
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

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Saturday April 09, 2005
03:13 PM

Perl6 Cookbook

[ #24095 ]

Following autrijus' request for someone to create a pleac directory (basically, a Perl 6 Cookbook), I've started Pugs hacking. Here's examples/pleac/01strings/01-04converting-values.p6.


use v6;

# you want to convert characters to their numeric value or vice-versa
my $char = 'a';
my $num  = $char.ord;
say $num;
my $char2 = $num.chr;
say $char2;

$char = 'foo';
say $char.ord; # XXX is this correct behavior?

Every example I'm typing up is showing limitations with pugs, but they're also showing the power of pugs, too. I'm very impressed. Come join the fun! We need more folks hacking on the cookbook. Correct my Perl 6 code and write it in a more idiomatic style! Not, of course, that we've nailed down Perl 6 best practices yet, but I am trying to take advantage of Perl6 features rather than just cut-n-drool Perl 5 code.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.