Well, he does return a reference to that hash at the end, so that part makes sense.
Comment1: The shift at the beginning is implicitly shifting off of @_ to pull the first parameter to the function into $ifn. The open would be better written as: open my $IFH, '<', $ifn or die "Cannot open file '$ifn': reason = $!\n"; so that you can see WHY it failed to open via the $!.
Comment2: Initializing $ret{A} through $ret{T} to be new arrayrefs as they come up in the loop. The loop would be better written as for my $j (@nucleotides) {...}, and then use $j in place of $nucleotides[$j]
Comment3: The -> is redundant. But it seems to me the whole darn $i loop is redundant too. It could be more simply written as $ret{$nucleotides[$j]} = split(/\s+/, $line); (note the comment 2 replacement could simplify the $j here too). My guess for this one is that the Boss is thinking C, and is doing a manual memcpy().
Putting the first line of the file into $ret{A} and the fourth line into $ret{T} seems very odd, but I've no idea what the later use is, so maybe it makes sense.
In reply to Re: trouble understanding boss's code
by SuicideJunkie
in thread trouble understanding boss's code
by DanielM0412
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |