in reply to Re: Concatenating text for a hash problem
in thread Concatenating text for a hash problem

I have to wake up earlier =). I've come with a similar solution redefining $/, but this time using split. Here is:

#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my %hash; local $/ = ">"; <DATA>; #Skip first ">" while(<DATA>){ my ($key,$value) = split /\n/, $_ , 2; $key =~ s/(\S+).*?$/$1/; $value =~ s/\n\>?//g; $hash{$key} = $value; } print Dumper \%hash; __DATA__ >EP11110 (-) TGCAATCACTAGCAAGCTCTC GCTGCCGTCACTAGCCTGTGG >EP40005 (+) GGGGCTAGGGTTAGTTCTGGA NNNNNNNNNNNNNNNNNNNNN __OUTPUT__ $VAR1 = { 'EP40005' => 'GGGGCTAGGGTTAGTTCTGGANNNNNNNNNNNNNNNNNNNNN', 'EP11110' => 'TGCAATCACTAGCAAGCTCTCGCTGCCGTCACTAGCCTGTGG' };

Regards,
deibyz