
KevinR
Veteran

Jan 20, 2005, 12:10 AM
Views: 2186
|
|
Re: [sfo_sc] Read a file from a specific line and extract something to another file
|
|
|
I think maybe you want to use "if" instead of "while" here:
while ($file[$i] =~ m/^\t/ || $file[$i] =~ m/^Caused/ || length($file[$i]) == 0 || $file[$i] =~ m/^\s/) { push(@temp, $file[$i] . "\n"); $i++; } "while" is generally used for looping through lists or files while a condition is true. "if" is used to make a decision based on the evaluation of an expression. what you have is something like this:
$num = 1; while ($num == 1) { print "AHHHH!!"; } since $num will always equal 1, the condition will always be true, and the loop will never exit. Now go get some sleep! -------------------------------------------------
(This post was edited by KevinR on Jan 20, 2005, 12:13 AM)
|