summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/perl-mode.el6
-rwxr-xr-xtest/manual/indent/perl.perl12
2 files changed, 16 insertions, 2 deletions
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 20834dd2e1e..d4e4f07b76b 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -191,7 +191,9 @@
,(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.
@@ -212,7 +214,7 @@
(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
diff --git a/test/manual/indent/perl.perl b/test/manual/indent/perl.perl
index 6ec04303b4f..db94552a928 100755
--- a/test/manual/indent/perl.perl
+++ b/test/manual/indent/perl.perl
@@ -95,3 +95,15 @@ s#ijk#lmn#g; # This is a regular expression sustitution.
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";
+ }
+}