DEV Community

Discussion on: Yet Another Perl Switch Statement

Collapse
 
matthewpersico profile image
Matthew O. Persico

Not exactly what I'd want. I'd rather see:

match($n) {
   case(1 : ==) { say "It's one" }
   case(2 : ==) { say "It's two" }
   case(3 : ==) { say "It's three" }
   case(4 : >=) { say "It's four or greater" }
   default { say "It's something else" }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
yukikimoto profile image
Yuki Kimoto - SPVM Author

If you want to write so, Syntax::Keyword::Match is insufficient.