while ($temp=){ RemoveComments(\$temp); next if ($temp !~ /\S/); ... some other code ... }