Who Knows The Problem In This Perl Script
2
0
Entering edit mode
10.6 years ago
2011101101 ▴ 110
$  perl duplex.pl 2.gff out.fasta [table_file] file.out fasta_file
   Use of uninitialized value $m in string ne at duplex.pl line 109, <GEN0> line 1.

How to change it? duplex.pl

perl • 2.5k views
ADD COMMENT
1
Entering edit mode

Just a simple suggestion: next time, you can use pastebin to paste your code. http://pastebin.com/

ADD REPLY
0
Entering edit mode

thank you very much

ADD REPLY
3
Entering edit mode
10.6 years ago

If I see that correctly, you define the variable "m" in line 18, but never initialize it as anything. I think you want it to start as zero since you increment it on line 104?

Your script breaks because it tries to compare "m", which has no value, to something. I'm unsure why you compare it to an empty string.

ADD COMMENT
3
Entering edit mode
10.6 years ago
kzarns ▴ 30

change

#!/usr/bin/perl -w

to

#!/usr/bin/perl
use strict;
use warnings;

The -w flag you have in you #! does the same as use warnings but is discouraged as it is less common, see the man page for perl or perldoc http://perldoc.perl.org/perl.html

use strict http://perldoc.perl.org/strict.html Using both strict and warnings will improve code quality. This will point out situations like @Philipp noted, $m in duplex.pl is incremented before being initialized. It is common practice to include these lines in every script.

ADD COMMENT
0
Entering edit mode

By placing the use strict pragma at the beginning of your code (as the first line after the "shebang" which points to the perl executable). perl can perform some useful optimizations which can prove beneficial with regard to execution speed, memory management, etc.

~Caitlin

ADD REPLY
0
Entering edit mode

Thank you very much

ADD REPLY

Login before adding your answer.

Traffic: 1833 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6