Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the Switch module deprecated in Perl?

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.

like image 621
Louise Avatar asked Apr 13 '10 14:04

Louise


People also ask

Can we use switch in Perl?

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.

What is switch in Perl?

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.


1 Answers

Perl 5.10 introduced a real switch called given-when

The old Switch used source filtering and had other limitations.

like image 156
Quentin Avatar answered Oct 21 '22 10:10

Quentin