in reply to memory variables (chp. 9 & 10 Learning Perl 3)
As others have said, \1, \2 etc are used inside the pattern, and $1, $2 outside it. But I'm pretty sure of two things: a) you're missing a closing paren in the examples and b) you've reproduced what I assume is a typo in the book (p111 in my copy), where it says 'flintsone' instead of 'flintstone' (no doubt merlyn will correct me if I'm wrong in my assumption ;-). So I presume it should really be:
/((fred|wilma) (flintstone)) \2/ # could be fred flintstone fred /((fred|wilma) (flintstone)) \1/ # could be fred flintstone fred flint +stone
HTH, mooseboy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: memory variables (chp. 9 & 10 Learning Perl 3)
by xtype (Deacon) on Sep 18, 2003 at 17:02 UTC |