Thoughts on some new operators for perl (6 or 7)by BigLug (Chaplain)
|on Mar 10, 2004 at 05:34 UTC||Need Help??|
I have a few things I'd like to see in perl 6 (or 7). (They may already be in development, I don't read as much apocolyptic literature as I probably should.)
Consider this code:
Now I'd like to get rid of the '= $_ if $_ >' as it's annoyingly long winded. In the spirit of ||= ('or equals'), let me suggest =>> become 'equals the greater' and =<< become 'equals the lesser'. So now we have:
(I'd use '=>' but that would be confusing to perl5ers.)
There'd also be string equivelents:
Note that my =<< and el operators would consider anything defined to be less than 'undef' which is why the my declarations for $lowest are undef. This means we don't have to guess a value that is higher than the lowest value when initialising.
Thoughts? Comments? Ridicule?
Update: Fixed typo pointed out by NetWallah. Added a pile of semi-colons.
"Get real! This is a discussion group, not a helpdesk. You post something, we discuss its implications. If the discussion happens to answer a question you've asked, that's incidental." -- email@example.com in clpm