I am using switch statements in a couple subroutines located in the same script. In the first subroutine I have a few switch statements. Here is one example:
switch ( $time ) {
case "30days" {
$caption .= "Past 30 Days";
}
case "3mons" {
$caption .= "Past 3 Months";
}
case "1yr" {
$caption .= "Past 1 Year";
}
case "all" {
$caption .= "All Data";
}
}
These statements worked fine until I added a second subroutine and duplicated the switch statements verbatim. Now I am receiving the following compiler errors:
Unquoted string "case" may clash with future reserved word at ./genera
+te_xml.pl_edit line 615.
String found where operator expected at ./generate_xml.pl_edit line 61
+5, near "case "all""
(Do you need to predeclare case?)
Unquoted string "case" may clash with future reserved word at ./genera
+te_xml.pl_edit line 618.
String found where operator expected at ./generate_xml.pl_edit line 61
+8, near "case "regular""
(Do you need to predeclare case?)
syntax error at ./generate_xml.pl_edit line 614, near ") {"
syntax error at ./generate_xml.pl_edit line 618, near "case "regular""
These are all referencing a switch statement in the second subroutine. I have scoured my code and cannot find any syntax errors that would cause these errors. (I especially looked around line 614, but there is nothing different. It has been copied verbatim from the first subroutine.)
I have included
use Switch;.
Any suggestions?