DCPM: emacs sytax highlighting in cperl-mode

Matthew Browning mb at matthewb.org
Mon Dec 1 04:11:45 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 01 December 2003 09:57, Steve Marvell wrote:
> Try some of the good ones like regular expressions with quotes in
> them.
>

The following stinkiness indents and highlights correctly (i.e. I press 
`tab' and it does the right thing:

#!/usr/bin/perl

use strict;
use warnings FATAL => 'all';

$\ = qq[\n];

for( qw]
	this
	ain't
	no
	"joke"
       ]
   ) {

  my $test = $_;

  $test =~ s!        # useful
	      ('|")  # comment
	    !${{q"'"=>q'"'=>q'"'=>q"'"=>}}{$1}!xg;

  print $test;
}

exit;



- -- 
http://matthewb.org/public_key.txt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/yxPhy5o0lRFL2ooRAvz2AKDSEZDm/hqmviSwqzKxxq/TrKmw0ACeIfiz
UiMePGsb/X666IO+Idvx/Uc=
=1edr
-----END PGP SIGNATURE-----



More information about the Devoncornwall-pm mailing list