Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: C:/Perl64/site/lib C:/Perl64/lib) at sampleswitch.pl line 2.BEGIN failed--compilation aborted at sampleswitch.pl line 2.code:#!/usr/bin/perluse Switch;$var = 'Linux';switch ($var) { case 'Perl' {print "I am Perl\n";} case 'Java' {print "I am Java\n";} case 'Linux' {print "I am Linux\n";} else {print "I am not a computer language\n";}}
238 visits
Outline:if-elsif-else conditional statement is used to check specific condition and if it is true execute the respective block else execute the default else block. switch is conditional case statement. Satisfied case gets execute else the default case gets execute.
if-elsif-else conditional statement is used to check specific condition and if it is true execute the respective block else execute the default else block. switch is conditional case statement. Satisfied case gets execute else the default case gets execute.
Show video info
Pre-requisite