Hello List,

I'm stumped on this one.

I'm getting this error:

Use of uninitialized value in length at ./DBSR.pl line 21, <> line 6.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 8.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 10.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 13.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 16.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 23.
Use of uninitialized value in length at ./DBSR.pl line 21, <> line 25.

 I just want to skip to the next line of input data if any of the
array elements have no value (0 in length).

#!/usr/bin/perl
use warnings;
use strict;
use POSIX;
use Data::Dumper;

my $fileOut = "testOut.txt";

open my $fin, '<', $fileIn or die "ERROR opening $fileIn: $!";
open my $out, '>', $fileOut or die "ERROR opening $fileOut: $!";

my @fields;

while( <> ) {
  next unless /;/;
  chomp;
  my @data = split /;/;
  my($Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd) = @data[9,10,27,36,37,40];
    next if(length($Icell) == 0);
    next if(length($Isect) == 0);
    next if(length($cfc) == 0);
    next if(length($cfcq) == 0);
    next if(length($rtd) == 0);
    $rtd = sprintf "%.2f", $rtd/8/6.6/2;
    push(@fields, $Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd);
}
print Dumper \@fields;

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