On 9/27/06, Aaron Sherman <[EMAIL PROTECTED]> wrote:
BTW: for the above, it would be nice to be able to say:
when m:i/^perl$/ {...}
without all the "noise". That is, it would be nice to have something like:
when 'perl':i {...}
Well, there are a few ways to do that:
given lc $lang {...}
when { lc eq 'perl' } {...}
when insensitive('perl') {...}
Where the last one is a user-defined function which can be written:
sub insensitive($str) { /:i ^ $str $/ }
Such "pattern functions" can be useful in a variety of contexts. That
is, write functions which are designed explicitly to be used in the
conditions of when statements.
Luke