* lisp/progmodes/perl-mode.el (perl-font-lock-keywords-2): Add
keywords "when", "given" and "default". (Bug#10560)
(perl--syntax-exp-intro-keywords): Add "printf".
* test/manual/indent/perl.perl: Add test for "when"/"given".
,(concat "\\<"
(regexp-opt '("if" "until" "while" "elsif" "else" "unless"
"do" "dump" "for" "foreach" "exit" "die"
- "BEGIN" "END" "return" "exec" "eval") t)
+ "BEGIN" "END" "return" "exec" "eval"
+ "when" "given" "default")
+ t)
"\\>")
;;
;; Fontify declarators and prefixes as types.
(eval-and-compile
(defconst perl--syntax-exp-intro-keywords
- '("split" "if" "unless" "until" "while" "print"
+ '("split" "if" "unless" "until" "while" "print" "printf"
"grep" "map" "not" "or" "and" "for" "foreach" "return"))
(defconst perl--syntax-exp-intro-regexp
s #lmn#opq#g; # FIXME: this should be a comment starting with "#lmn"
/lmn/rst/g; # and this is the actual regular expression
print; # prints "rstrst\n"
+
+given ($num) {
+ when ($num>10) {
+ printf "number is greater than 10\n";
+ }
+ when ($num<10) {
+ printf "number is less than 10\n";
+ }
+ default {
+ printf "number is equal to 10\n";
+ }
+}