On Tue, Jul 11, 2000 at 11:34:59PM +0000, Herbert Xu wrote:
> > Except that in Perl the $ord would normally be interpreted as the variable
> > $ord, and thus the $ needs to be quoted (or some other quoting would be
> > required).
>
> But in the scope of a regex, the first $ can not be interpreted as the prefix
> of a variable. The second may be but only if you use s///e.
Umm.. Perl disagrees with you :)
isd70{showard}5: cat q.pl
#!/usr/bin/perl
$aa="bb";
while(<>) {
s/$aa/xx/g;
print;
}
isd70{showard}6: ./q.pl
$aa <- Enter this
$aa <- It didn't match
bb <- Enter this
xx <- And it did!
isd70{showard}7:
It's matching on the contents of the variable, not "$aa".
Scott.
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug
- [SLUG] Stupid Regex questions.. Anthony Rumble
- Re: [SLUG] Stupid Regex questions.. Alexander Else
- Re: [SLUG] Stupid Regex questions.. Herbert Xu
- Re: [SLUG] Stupid Regex questions.. Rick Welykochy
- Re: [SLUG] Stupid Regex questions.. Anthony Rumble
- Re: [SLUG] Stupid Regex questions.. Rick Welykochy
- [SLUG] Re: Stupid Regex questions.. Angus Lees
- Re: [SLUG] Re: Stupid Regex questions... Herbert Xu
- Re: [SLUG] Stupid Regex questions.. Scott Howard
- Re: [SLUG] Stupid Regex questions.. Herbert Xu
- Re: [SLUG] Stupid Regex questions... Scott Howard
- Re: [SLUG] Stupid Regex quest... Herbert Xu
- Re: [SLUG] Stupid Regex questions.. Jim Clark
- Re: [SLUG] Stupid Regex questions.. Scott Howard
