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" } }