[Omaha.pm] Do you ~~ ?
Travis McArthur
travis at travisbsd.org
Thu Apr 1 16:37:12 PDT 2010
Wasn't aware of this except in the "given/when" example shown. Very nice!
Also, I thought given/when is in Perl 6 only? Did I miss something? Admittedly I haven't had as much time to mess with hacking Perl lately!
Best Regards,
Travis
On Apr 1, 2010, at 1:52 PM, Theodore Katseres wrote:
> 2010/4/1 Jay Hannah <jay at jays.net>
> Wow. smartmatch.
>
> use 5.10.0;
> if ($a ~~ $b) {
>
> http://perldoc.perl.org/perlsyn.html#Smart-matching-in-detail
>
> Anyone use this beast?
>
> I use implicit smart matching with the when statement the most.
>
> eg.
>
> given ( $a ) {
> when ( $b ) { dosomething(); }
> default { dosomethingelse(); }
> }
>
> --
> Ted Katseres
> ||=O=||
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at pm.org
> http://mail.pm.org/mailman/listinfo/omaha-pm
--
Travis McArthur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20100401/47038bb2/attachment.html>
More information about the Omaha-pm
mailing list