use v5.10; use warnings; foreach ( 'a', 'z', 5..11 ) { when( /a/ ) { say "$_ : ", 'Matched an a' } when( [ 2..5 ] ) { say "$_ : Matched 2 through 5" } #line 7 when( [ 6..10 ] ) { say "$_ : Matched 6 through 10" } default { say "$_ : Matched nothing" } } #### a : Matched an a Argument "z" isn't numeric in smart match at C:\b\perlmonks\switch.pl line 7. z : Matched nothing 5 : Matched 2 through 5 6 : Matched 6 through 10 7 : Matched 6 through 10 8 : Matched 6 through 10 9 : Matched 6 through 10 10 : Matched 6 through 10 11 : Matched nothing