ccelt09 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks! I am having difficulty discerning the source of an error in my code and or/input data. I attempt to filter data from one file to another based on what I call start and end positions.
open (CG, "<$cg_input") or die "can't open $cg_input\n"; my @SNPs = <CG>; close(CG); my $interval = "/Users/logancurtis-whitchurch/Desktop/chrX_divisions/" +."$region"."_$filter".".txt"; #specifiecs intervals by region and fil +ter version open (INTERVAL, "<$interval") or die "can't open interval file\n"; foreach ( <INTERVAL> ) { my (undef, $start, $end) = split '\s+', $_; my $switch = 1; while ($switch == 1) { my @get_SNPs = split('\s+', $SNPs[$placeholder]); my $position = $get_SNPs[3]; if (($position < $start) && ($position < $end)) { $placeholder++; } if (($position >= $start) && ($position <= $end)) { print OUT "@get_SNPs\n"; $placeholder++; } if (($position > $start) && ($position > $end)) { $switch =! 1; } } } close(INTERVAL);
The error message returned to me is as follows on repeating loop, until I terminate the program. Line 246 of my interval input file corresponds to the last line of the file, which looks no different from any of the others. I am at a loss regarding the uninitialized value, especially when identically formatted files have worked with the same code.
Use of uninitialized value in split at filter.CGS.pl line 43, <INTERV +AL> line 264. Use of uninitialized value $position in numeric lt (<) at filter.CGS.p +l line 46, <INTERVAL> line 264. Use of uninitialized value $position in numeric lt (<) at filter.CGS.p +l line 46, <INTERVAL> line 264. Use of uninitialized value $position in numeric ge (>=) at filter.CGS. +pl line 50, <INTERVAL> line 264. Use of uninitialized value $position in numeric gt (>) at filter.CGS.p +l line 54, <INTERVAL> line 264. Use of uninitialized value in split at filter.CGS.pl line 43, <INTERVA +L> line 264.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tracing an Uninitialized Error
by toolic (Bishop) on Jan 30, 2014 at 13:16 UTC | |
by Anonymous Monk on Jan 30, 2014 at 21:27 UTC | |
|
Re: Tracing an Uninitialized Error
by Random_Walk (Prior) on Jan 30, 2014 at 15:01 UTC | |
|
Re: Tracing an Uninitialized Error
by GotToBTru (Prior) on Jan 30, 2014 at 15:20 UTC | |
|
Re: Tracing an Uninitialized Error
by Crackers2 (Parson) on Jan 30, 2014 at 17:21 UTC | |
by ccelt09 (Sexton) on Jan 31, 2014 at 01:24 UTC | |
by Anonymous Monk on Jan 31, 2014 at 08:18 UTC |