in reply to
check in an array for variable
I don't quite understand what you are trying to achieve, the expected output would have been helpful.
But I see three problems in your code:
The quantified capture
(\w+?;)*
probably won't do what you think it does.
defined ($2)
produces either the empty string or a
1
, probably not what you expect.
You don't
use strict and warnings
.
Comment on
Re: check in an array for variable
Select
or
Download
Code
Replies are listed 'Best First'.
Re^2: check in an array for variable
by
Anonymous Monk
on Aug 13, 2009 at 08:32 UTC
$line =~ s/(&\w+?;)(\w+)(&\w+?;)/exists $text{$2} ? $2 : defined($2)/eg;
I am trying to find the string between two values which is present in array.
ie; regular expression to find the string between one text in an another to another.
[reply]
[d/l]
In Section
Seekers of Perl Wisdom