On Tue, Oct 05, 2004 at 03:33:31PM -0500, Jason Pepas wrote:
> here's a perl question for the list.
> 
> how does one resolve the ambiguity between octal references and
> backreferences followed by numbers?
> 
> example:
> 
> to replace foobar with fubar, I could use the following:
> 
>     s/foo(bar)/fu\1/
> 
> but let's say I wanted to replace it with fubar01:
> 
>     s/foo(bar)/fu\101/
> 
> unfortunately, \101 is interpreted as octal 101 instead of backreference
> 1 followed by 01.
> 
> any ideas?
> 
> -jason

I'm no perl expert, but this seems to work:

  s/foo(bar)/fu\1\00001/

'\000' should be the null character (a.k.a. '\0'), and I guess it just
strips certain non-printables (or maybe just the null character).

Or maybe this will have some freaky effect if you use it. *shrug*

hth

 danb

-- 
Daniel Brown
www.utacm.org
www.cs.utexas.edu
_______________________________________________
Siglinux mailing list
[EMAIL PROTECTED]
http://machito.utacm.org/mailman/listinfo/siglinux

Reply via email to