Home » Perl switch

Perl Switch Statement

The perl switch statement is used to execute the code from multiple conditions. There is no case or switch statement in perl. Instead we use ‘when’ in place of case and ‘given’ in place of case.

The syntax of switch statement in perl language is given below:


Perl Switch Example

Let’s see a simple example of c language switch statement.

Output:

Enter a Number  10  It is 10  
Enter a Number  55  'Not 10, 20 or 30'  

You may also like