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++)

This is better written as
for (-25..25) {

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


Yuk! Why the loop?
(untested, just to give you an idea):

if (/RD(\d*)/) and $1 >= -25 and $1 <= 25) ....

jue


.



Relevant Pages

  • Re: Process notification
    ... As you see from prev. ... posts there is no obsolute user mode solution on how ... and then immidiatly terminated - your "monitoring loop" may not detect it. ... Vladimir ...
    (microsoft.public.win32.programmer.kernel)
  • RE: Extreme beginner question on reading lines from a file.
    ... print FILEOUT "M98PPECK.SUBL1\n"; ... the 1st line is written into $prev. ... This code will fail if there's ... If it fails it returns false and the loop exits. ...
    (perl.beginners)
  • copy error
    ... each time through loop ... It also returns a '1' which I dont not understand since it ... Shouldnt it be '0'? ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: increasing counter whithin loop?
    ... Notching up the counter in a C-style loop is a _concise_ way to do ... prev = nil ... prev = elt ... I'm not sure I would find the C version clearer if I ...
    (comp.lang.ruby)
  • Re: Append Documents
    ... you'll have to built a userform to list the files (probably ... in a listbox) so users can pick the files they want. ... Then loop through ... Prev by Date: ...
    (microsoft.public.word.vba.general)