Why can I get a syntax error when I use & ldquo; I gave "rdquo"?


I'm trying to run the following code:

foreach my $k (keys %rec) {
    #switch for watchlist figures
    given ($k) { #line 93

        # Code omitted

        when ("p") { #positive breakout
            if ($row{cls} > $rec{$k}) {
                $email .= "positive";
            } # line 104
        when ("n") { #negative breakout
            if ($row{cls} < $rec{$k}) { #line 107

But I get a syntax error:

syntax error at check_watch.pl line 93, near ") {"
syntax error at check_watch.pl line 104, near "}"
Unterminated <> operator at check_watch.pl line 107.


given and when are only available when either use feature "switch"; or use v5.10; (or some later value) is in effect. Place one of those lines at the top of your source file.