Mailing List Archive

Escaping Perl code?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I knew I had to escape [. when I'm in HTML (or at least, that I
should). However, this is the first time I've run across an escape
problem inside of my Perl code.

[-
(/^(\s*)([o*+\200])\s+[^*]+$/ || /^(\s+)([-])\s+.*$/);
- -]

Generates the error:

[9636]ERR: 24: Line 2: Error in Perl code: (in cleanup) [Mon May 1
11:52:06 2000] foo.html: Search pattern not terminated at
/usr/local/www/onecallweb/docs/foo.html line 3.

Clearly the -] is causing problems, but how do I escape it?
- --

Kee Hinckley - Somewhere Consulting Group - Cyberspace Architects(rm)

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>

iQA/AwUBOQ2pLCZsPfdw+r2CEQJ6RACg7DXHUrKA2KX6w9NxSy+fvyPTS1MAoJdD
kRLh8I4SFs0XCNFSrxc+2eP4
=k8zn
-----END PGP SIGNATURE-----
RE: Escaping Perl code? [ In reply to ]
>
> [-
> (/^(\s*)([o*+\200])\s+[^*]+$/ || /^(\s+)([-])\s+.*$/);
> - -]
>
> Generates the error:
>
> [9636]ERR: 24: Line 2: Error in Perl code: (in cleanup) [Mon May 1
> 11:52:06 2000] foo.html: Search pattern not terminated at
> /usr/local/www/onecallweb/docs/foo.html line 3.
>
> Clearly the -] is causing problems, but how do I escape it?


Replaceing - by \x2d should solve the problem.

Gerald

-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------