Hi everyone,

I try to run one script, and I get this message, I do not know what it's means

Use of uninitialized value $out in concatenation (.) or string at blas +tall_modificado line 20. readline() on closed filehandle $IN at blastall_modificado line 26. Use of uninitialized value $out in concatenation (.) or string at blas +tall_modificado line 80. is done

line

20 open my $OUT, '>', "$out.out"; 26 while (my $line = <$IN>){ 79 print "$out is done\n";

Now the errors are :

Global symbol "$out" requires explicit package name at script line 20.

Global symbol "$out" requires explicit package name at script line 79.

Execution of script aborted due to compilation errors.

#!/usr/bin/perl use warnings; use strict; my @outs; my %grupos1; my %grupos2; my @split; #my $out; my @element2; my @element1; open my $IN , '<', " $ARGV[0]"; open my $OUT, '>', "$out.out" or die "open failed: $!\n"; #########################---- while (my $line = <$IN>){ chomp $line; my @split = split /\t/, $line; my $id1 = join ("\t", @split); if (!defined $grupos1{$id1}) { $grupos1{$id1}= []; } #close defined hash %grupos1 if push @{$grupos1{$id1}}, [$split[0],$split[1],$split[2],$split[3],$ +split[4]]; }# close while close $IN; #----------------------------------- open my $IN2 , '<', "$ARGV[1]"; while (my $line2=<$IN2>) { chomp $line2; my @split2 = split /\t/, $line2; my $id2 = join ("\t", @split); if (!defined $grupos2{$id2}) { $grupos2{$id2}= []; } #close defined hash %grupos2 if push @{$grupos2{$id2}}, [$split2[12],$split2[1], $split2[10], $spl +it2[11]]; } #close while close $IN2; foreach my $key1 ( sort keys %grupos1 ) { for my $element1 ( @{ $grupos1{$key1} } ) { #derefrence foreach my $key2 ( sort keys %grupos2 ) { for my $element2 ( @{ $grupos2{$key2} } ) { if ( $element1->[0] eq $element2->[0]){ my $new_start= $element1->[2]+$element2->[2]; my $new_end= $element1->[3]+$element2->[3]; print $OUT, "$element1->[1]\t$new_start\t$new_end +\t$element2[1]\t.\t$element1[4].\t.$element2[0]\n"; } ## end if } #end foreach key1 } } #end foreach key2 } #end foreach key1 print "$out is done\n"; %grupos1 = (); #empty hash %grupos2 = (); #empty hash close $OUT; #} #close genome

Thanks you so much for your help


In reply to I get these errors when I perform the script by mgamar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.