use strict;
use warnings;
use Switch;
for ('abc', 'def', 'ghi')
{
switch ()
{
case /bc/ { print "$_: matches 'bc'\n"; }
case /de/ { print "$_: matches 'de'\n"; }
case '' { print "EMPTY STRING\n"; }
else { print "$_: no match found\n"; }
}
}
####
1:51 >perl 1675_SoPW.pl
EMPTY STRING
EMPTY STRING
EMPTY STRING
1:51 >
##
##
MAIN_LOOP: while () {
chomp;
s/^\s+//; # Remove leading blanks (if any) in the line
# ignore line if it contains comments or initializing words for spectre
switch ($_) {
case /^[*\/]/i { next MAIN_LOOP; }
case /simulator\s+lang/i { next MAIN_LOOP; }
case /^include/i { next MAIN_LOOP; }
}
...
}