>
>> What would be the best way to omit any record when varible $dist is
>> null or not>  1 ?
>
> But from your code, I assume you mean to omit records when the _length_
> of $dist isn't greater than one?
>
> I would make the check immediately $dest is assigned, and 'next' over
> the record in the same way as you do for those that contain no semicolon.
>
>  my($cell,$sect,$chan,$rlp1,$rlp2,$rlp3,$rlp4,$dist) =
>      @data[31,32,38,44,45,46,47,261];
>
>  next unless length $data > 1;
>
> and then later on, you know $dist is valid so there is no need for the
> test when you are reformatting it:
>
>  $dist = sprintf "%.1f", $dist/8/6.6/2;
>
> HTH,
>
> Rob
>

Thank you Rob. Your advise worked perfectly.
One more question. Is it possible to combine the three next if
statements below? So the code if doesn't take 3 lines?

          next if(length($dist) == 0);
          next if(length($cell) == 0);
          next if(length($sect) == 0);

Thank you,

Chris

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to