> the following is an as yet incomplete regex that i'm working on:
> 
> $data = $_ =~
> s/<(name)>(.*?)<(desc)>(.*?)<(copy)>(.*?)<(license)>(.*?)<(entry)>//xg
> 
> 
> every other capture ($1 $3 $5 $7 $9) is going to be used one way, the
> other
> captures will be used differently...  i'm wondering if there's a way to
> force the captures into particular numbered variable, so that
> $1 =$1
> $2 = $3
> $3 = $5
> $4 = $7
> $5 = $9
>

How about just not capturing them to begin with?  If you add C<?:> to
the beginning of your capture it will ignore the capture.  Having said
that, why are you capturing to begin with if you are just going to throw
them away?  The parens in your example don't matter for the match to work. 

> etc...  or is it even worth it for easier coding later on?
> 

At the very least I would switch to named variables to make it more
readable and prevent the chance that they get clobbered by a later regex.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to