in reply to Backreference woes

With the line my $textIn = <STDIN>; you only get one line of input. If that line has no backticks you get no substitution. You probably want to do a while (<STDIN>) {} loop around the substitution and printing.

If you get a line with two backticked sections, you will get a surprise. The regex qr/`(.*)`/ is greedy and will match everything between the first on the line and the last. Try qr/`(.*?)`/ or qr/`([^`]*)`/ to get what you want.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Backreference woes
by bemfica (Initiate) on Jan 02, 2004 at 04:42 UTC
    Thank you very much for the hints. I knew about the "while" bit, and had stripped it only for the posting. I do welcome the reminder, though - I should get used to it (as well as the "greedy" bit) or will eventually be surprised!

    A.