News for hackers. Stuff that matters.
Re:What’s new in Perl 5, Version 13 by draegtun on Tuesday September 28, 2010 @09:27AM (#1735590)
Yep but the given/when is DRYer because you don't need to repeat the $grade eq

re: smart match & more complicated than `eq` - Yes you can push given/when quite a bit:

    given (TheTime->of_day) {

        when ('morning') {
            breakfast();
            make_packed_lunch() if $_->is_work_day;
        }

        lunch() when 'afternoon';

        when ('evening') {
            goto_pub() if $_->is_friday;
            dinner();
        }

        default { say "Should be sleeping if its " . $_->{dt}->ymd }
    } 
ref: http://stackoverflow.com/questions/3638892/what-kind-of-neat...

There are no comments on this comment yet.