in reply to Re^2: How to get rid of the errors in my perl script
in thread How to get rid of the errors in my perl script
i am not getting errors as well as output
That’s because you’ve removed
use strict; use warnings;
from the head of your script, although they were there in the original. With use strict restored, the errors return:
Global symbol "$count" requires explicit package name at test.pl line +13. Global symbol "@line" requires explicit package name at test.pl line 1 +5. Global symbol "@line" requires explicit package name at test.pl line 1 +9. Global symbol "@line" requires explicit package name at test.pl line 2 +5. test.pl had compilation errors.
You need to declare my $count and my @line before the while loop, so that they will still be visible in the following for loop:
... my (@line, $count); while (<$fhConditions>) { push @line, $_; $count++; } for (my $i = 0; $i < $count; $i++) { my @pos = $line[$i] =~ /chr[0-9]\s+(.+?)\s/g; ...
See the section “Scope” in the “Functions” chapter of chromatic’s Modern Perl, available free online at http://modernperlbooks.com/books/modern_perl/.
Note: In your original question, you gave a sample of the contents of your first input file (1.txt), but not of the second (2.txt), so it’s difficult to see what your script is trying to do.
Athanasius <°(((>< contra mundum
|
|---|