Tim Landscheidt
Tim Landscheidt

Reputation: 1400

How do I specify string references in perl-mode and not make Emacs dizzy?

I need to use references to (constant) strings in Perl. If I write:

my $a = \'test';
print $$a;

Emacs (23.3.1)'s perl-mode thinks that a string starts at the second apostrophe and messes up filling and fontification. Using double quotes (") doesn't change this.

How can I work around this without using extra variables or switching to cperl-mode which I find rather "loud"?

Upvotes: 2

Views: 52

Answers (1)

choroba
choroba

Reputation: 241968

Add a space after the backslash. Perl does not care and perl-mode catches up.

Upvotes: 4

Related Questions