Title: Message
          Hi,
      I am trying to use the CPAN module Regexp::Subst::Parallel.
The example code given in the documentation is
 
    $text = '{process_the_data} was _called_ without <data>!';
    $text = subst($text,
                qr/\{(.*?)\}/ => '$1',  # Protect things in braces
                qr/_(\w+)_/   => '<u>$1</u>',
                qr/<(\w+)>/   => '<i>$1</i>',
            );
   
Inside the subst(), a scalar and an array are populated using the passed arguments as follows:
(http://search.cpan.org/src/LPALMER/Regexp-Subst-Parallel-0.10/Parallel.pm )

    my $str = shift;
    my @subs;
    while (@_) {
        push @subs, [ shift, shift ];
    }
 
Instead of the above, I tried to create a global array outside and use it inside the subst().
(For simplicity of the discussion, I am avoiding passing the array by value or reference.)

my $text = '{process_the_data} was _called_ without <data>! ;

my @subs = ( [qr/\{(.*?)\}/ => '$1'],

             [qr/_(\w+)_/ => '<u>\$1</u>'],

             [qr/<(\w+)>/ => '<i>$1</i>'] );

$text = subst($text);

 
This doesn't work exactly as the previous one. Runs indefinite loop in the '<u>\$1</u>'.
If I remove that expression, it works partially. So I would like to know the difference between
these 2 methods of creating arrays. I appreciate your time and efforts in helping to solve this problem.
 
Thanks & regards,
Raja
 
**************************Disclaimer************************************************

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***************************************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to