Why was the Switch module deprecated in Perl 5.12?
I know that a switch
/case
be made with elsif
, but I don't like that very much.
Perl does not support the use of switch statements. A switch statement allows a variable to be tested against a set list of values. In Perl, the equivalent of the switch statement is the given-when syntax.
Advertisements. A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.
Perl 5.10 introduced a real switch called given-when
The old Switch used source filtering and had other limitations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With