in reply to For loop problem
if ($line =~ /^(\d{1,10})/){
This is going to evaluate to true if $line contains a string
of numbers. It will assign up to the first 10 consequitive numbers into $1.
if ($d =~ /^$key$/){
This is going to evaluate true if the string of numbers is contained within $d. In other words, this is going to evaluate to true if the very first string of numbers that you found in $line was a single digit between 0 and 9. So, any of the following lines are guaranteed to never match:
this is my 023 string hello 10 hi there 0 how are you 03
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: For loop problem
by matth (Monk) on Nov 29, 2002 at 10:35 UTC | |
by graff (Chancellor) on Dec 02, 2002 at 00:40 UTC |