#!/usr/bin/env perl -l # recent: # <> delimiters for q, qq, qw, qx, m # whitespace before delimiters (broken for s///) # fixed s[][] # fixed s()() my $foo = "WRONG"; my $bar = 'right'; # variables can have braces print "** variables with braces"; print ${bar}; print; # double-quoted -- $bar should be highlighted print "** double-quoted strings"; print "this is $bar"; print qq{this is $bar}; print qq {some${bar}thing}; print qq~this is $bar~; print qq ~this is $bar~; print qq(this is $bar); print qq (this is (this is $bar)); print qq{this is {this is (this is $bar)}}; print qx{echo -n 'this is $bar'}; print qx {echo -n 'this is $bar'}; print `echo -n this is $bar`; print qq'this is $bar'; print qq 'this is $bar'; print qq; print qq ; print eval{qqwrongw}; # should not be a string\n print eval{qq{right}}; print <; print q ; print q{this is {nested $foo}}; print qx'echo -n this is eaten by the shell: $foo'; print qx 'echo -n eaten: $foo'; print(join(" ", qw/this is $foo/)); print(join(" ", qw'this is $foo')); print eval{qwrongw}; # should not be a string print <<'END'; this is $foo END # regex m/bar/; m{bar}; m(bar); m[bar]; m; /this is $foo/; qr/this is $bar/; # interpolated qr /this is $bar/; qr'this is $foo'; # not interpolated qr 'this is $foo'; qr; qr ; qr{this is $bar}; qr {this is $bar}; qr(this is $bar); qr (this is $bar); eval{qrthisismonkeyt}; # should not be a regex s{bar}{this is $bar}; # second part should be a double-quoted string (?) s'bar'this is $foo'; # second part should be a single-quoted string s/some$bar/is interpolated/; s/some$/is not interpolated/; s/bar/this is $bar/; s/bar/$m = "monkey"/e; # second part should be an expression s; s ; s[this][that]; s [this][that]; s{this}{that}; s {this}{that}; s(this)(that); s (this)(that); # broken s /bar/foo/; s#this#that#; s #this#that#; tr{abc}{def}; #too much work s/bar/foo/ #comment ; s{bar}{foo} #comment ; s 'bar'this is $foo';