Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-11 Thread Bart Lateur
On Tue, 11 Mar 2003 08:05:05 -0800, Richard Cook wrote: >It's also useful to remember that this works for array building too: > >my (@list) = m/(your string here)/g; > >so that you can then test for if (@list) ... Cute. Do note that the /g modifier works differently in list context, as here, tha

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-11 Thread Richard Cook
Bart Lateur wrote: > > On Sun, 9 Mar 2003 21:21:47 -0500, Ronald J Kimball wrote: > > >I would suggest writing lines 92 and 93 like this: > > > >m/name\s*=\s*"?(\w+)"?/ and $name = $1; > > ... or > > ($name) = m/name\s*=\s*"?(\w+)"?/; > > which will set $name to $1 in case of a success

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-11 Thread Scott R. Godin
Detlef Lindenthal wrote: > ###Richard Smith wrote: > ### "... but the previous value of $1 still seems to > ### persist." > ### > ### > ### Hi Richard, > ### > ### In RegEx, the variables $1, $2, $3 ... might carry on > ### unwanted values from previous uses. > ### How can we

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-10 Thread Detlef Lindenthal
###Richard Smith wrote: ### "... but the previous value of $1 still seems to ### persist." ### ### ### Hi Richard, ### ### In RegEx, the variables $1, $2, $3 ... might carry on ### unwanted values from previous uses. ### How can we erase them? ### You can do this: $_ = "any

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-10 Thread Richard Smith
--- Ronald J Kimball <[EMAIL PROTECTED]> wrote: > On Mon, Mar 10, 2003 at 12:24:51AM +, Richard Smith wrote: > > 91: { > > 92: m/name\s*=\s*"*(\w+)"*/; > > 93: $1 and $name = $1; > > 94: } > > $

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-09 Thread Bart Lateur
On Sun, 9 Mar 2003 21:21:47 -0500, Ronald J Kimball wrote: >I would suggest writing lines 92 and 93 like this: > >m/name\s*=\s*"?(\w+)"?/ and $name = $1; ... or ($name) = m/name\s*=\s*"?(\w+)"?/; which will set $name to $1 in case of a successful match, and to undef otherwise. --

Re: [MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-09 Thread Ronald J Kimball
On Mon, Mar 10, 2003 at 12:24:51AM +, Richard Smith wrote: > 65: $text =~ s{ ( .*? ) } > 66: { &selection( $1 ) }gsex; > > .. > > 83: sub selection { > 84: > 85: my ( $name, $checked ); > 86: my $text = shift; > 87: my $

[MacPerl] Scope problems in regular expressions (please ignore previous)...

2003-03-09 Thread Richard Smith
Hi All, My apologies for the previous incomplete message. I blame my webmail client. I have an entire HTML template stored in $text. I want to use a RE to extract several blocks of marked text, then perforn RE's on each block line by line in a subroutine (&selection) and substitute that back into