Re: Perl match problem



yezi wrote:
If I want to find the text wheather match the RD[$j] $j is the any
number
between -25 to 25, can I write the following sentence :
for ($j=-25;$j<=25;$j++)
 if($parts[0] =~ /RD[$j]/)

I am not sure the is expression, since the code can not work. Thanks
for any comments

You do know that [ and ] are meta characters and must be escaped when matched?


if ($parts[0] =~ /RD\[$j\]/)


-- Josef Möllers (Pinguinpfleger bei FSC) If failure had no penalty success would not be a prize -- T. Pratchett

.



Relevant Pages