Hi Raj, some comments on your code.
On Sun, 20 Sep 2015 18:19:30 -0300 Raj Barath <barat...@live.com> wrote: > Hi, > > Is this is what you're looking for ? > Always start with "use strict;" and "use warnings;" or equivalent. > my %hash; > > while( my $line = <DATA> ){ 1. There should be a space before the "(". 2. There should be a space before the "{". > chomp $line; > my ( $scaf, $pro_per ) = $line =~ m/\sHit=(.*?)\s.*?Percent_id=(.*?)$/g; > push @{$hash{$1}}, $2; 1. Don't use the /g flag unless you're planning to match more than once. 2. Why aren't you using the matches in the returned arguments and instead are using $1 and $2? $1, $2 and friends should be avoided as much as possible. 3. You should check that the match succeeded. 4. I don't understand what "$scaf" and "$pro_per" mean. For more info, see: http://perl-begin.org/tutorials/bad-elements/ (Note: I wrote most of it.) Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Original Riddles - http://www.shlomifish.org/puzzles/ Wikipedia deletionists Don’t Die. They lose notability and get deleted. — http://www.shlomifish.org/humour.html Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/