in reply to Read FASTA into Hash

You never assign a new value to $header. Try changing the if like this:

if ($line =~ m/^>(.*)$/){ $header = $1;

See perlretut.

Replies are listed 'Best First'.
Re^2: Read FASTA into Hash
by ic23oluk (Sexton) on Jul 09, 2017 at 10:52 UTC

    works! Thank you very much!

      Yes, your method works as long as your input conforms to your specification (a simple subset of the FASTA format).
      Bill