On 12-05-17 10:47 AM, Chris Stinemetz wrote:
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 /;/;

# make sure every required field has a value
next if @data < 41;

   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



--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

*Perl links*
offical site    : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help    : http://perlmonks.org/
news            : http://perlsphere.net/
repository      : http://www.cpan.org/
blog            : http://blogs.perl.org/
regional groups : http://www.pm.org/

--
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