in reply to Concatenating text for a hash problem

Your code has a number of problems. First of all, $str is never set back to nothing, so it eventually contains all data lines - not just the current section of data. Next, you seem to be assigning $str contents to $hash{$1} before actually putting anything into $str. Did you want to assign a reference instead? That would be $hash{$1} = \$str, and for that to work properly, $str would have to be a variable created fresh for each assignment to a new $hash{$1} - probably by doing an if statement with my $str inside it.

Basically, the code needs to be rewritten somewhat. Here's my version for what you're trying to do:

use strict; use warnings; my %hash; while (<DATA>) { if (/>([\w]+) /) { } else { chomp; $hash{$1} .= $_; } } for (sort keys %hash) { print "$_ => $hash{$_}\n"; } __DATA__ >EP11110 (-) TGCAATCACTAGCAAGCTCTC GCTGCCGTCACTAGCCTGTGG >EP40005 (+) GGGGCTAGGGTTAGTTCTGGA NNNNNNNNNNNNNNNNNNNNN