Hello, Monks! Please, one more question. I didn't think I should start a new thread for this.
while( defined(my $head = <FASTQIN>) && defined(my $seq = <FASTQIN>) && defined(my $qhead = <FASTQIN>) && defined(my $quality = <FASTQIN>) ){ substr($head, 0, 1, '>'); my $temp = print $head, $seq; } close (FASTQIN); my %count_seq; open my $fh, '<:encoding(UTF-8)', $temp or die "Cannot open $temp +$!"; while (<$fh>) { chomp; next if /^>/; next if length($_) > 30 or length($_) < 15; $count_seq{$_}++; }
this is a section of code I am trying to write. Is there a way to make the variable  my $temp that was used in the while loop also available in the open filehandle statement? The code works OK till  close (FASTQIN);. the error reads:
Use of uninitialized value $temp in open at test.pl line 44. Use of uninitialized value $temp in concatenation (.) or string at tes +t.pl line 44. Cannot open No such file or directory at test.pl line 44.
Line 44 is this:
open my $fh, '<:encoding(UTF-8)', $temp or die "Cannot open $temp $!";
Kindly advise, monks! Thanks!

In reply to Re^2: Manipulating tab delimited file by andyBio
in thread Manipulating tab delimited file by andyBio

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.