Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Parsing and Finding Max Min

by RMGir (Prior)
on Dec 30, 2009 at 13:56 UTC ( #814944=note: print w/replies, xml ) Need Help??

in reply to Parsing and Finding Max Min

You should definitely be using strict and warnings, for starters.

Next, do you really intend to update

$hash{$Query}[3] = $one; $hash{$Query}[4] = $two;
in all 4 blocks? That seems strange.

If you didn't intend that, what I'd suggest is modifying your code to simplify things - it would also make debugging simpler.

while (<FH>) { my ($Query, $Score, $Start, $End, $one, $two) = split; my $aref=[$Score, $Start, $End, $one, $two]; if ( ! exists ( $hash{$Query} ) ) { $hash{$Query} = $aref; } else { if ( $hash{$Query}[1] > $Start ) { $hash{$Query} = $aref; } } if ( ! exists ( $hash2{$Query} ) ) { $hash2{$Query}= $aref; } else { if ( $hash2{$Query}[2] < $End ) { $hash2{$Query} = $aref; } } }
That might make things a bit easier to debug...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://814944]
[LanX]: interesting the author doesn't seem to accept javascript as a scripting language
[LanX]: ... and calls php7 the winner oO
[RonW]: RPerl is only a curiosity to me. I can see where some one who primarily codes in Perl might find RPerl useful, but to me, given the choice between RPerl's restrictions and C, I'd choose C

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-05-22 20:40 GMT
Find Nodes?
    Voting Booth?