yes, but it won't work with foreach (I cannot explain why - anyone?). this
does work though

while( /(\S+?)='(.*?)'/g) {
        $getty{$1}=$2;
}

I originally did something like this, but since you only wanted to match a
few things I thought the straight match would be simpler.

Keep in mind that you lose ordering this way. If you also wanted to
preserve order, push them onto a list as well, and use the list to access
the values in order.

I also had to change the regex slightly to match non whitespace chars for
the value in front of the =

If you ever want to know if something will work, just give it a try :)

charles

On Tue, 22 Feb 2000, Robert Canary wrote:

> Thanks Charles,
> 
> Once I knew what I was looking for I found it inthe books under "Backrefference" I 
>liked your
> explaination better.
> 
> What if one want to implement certain code each time a match was found. And do 
>something like this.
> 
> while (<FILE>) {
>     if (/pid=$getty_pid/ && /dev=$ttydev/) {
>         foreach (/(.*?)='(.*?)'/g) {
>         $getty{$1}=$2
>         }
>     }
> }
> 
> Is this legal?


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to