ive researched about shift, but only found broad answers that were no help, i cant avoid not understanding shift because it pops up everywhere!!
also, my friend pat showed me a sliding window for a long file, to find Xcharacter patterns,( it would look somethin like this) ACGTTGCAAGCTGTAAA, and there are a couple places are confusing me, help me? :) code is below, thanks in advance
sub getXCharacterPatterns{ my $str=shift; #what does shift do here? my $pl=shift; #andd here my $slen=length($str); if ($pl>$slen){ print "ERROR: $pl is greater than $slen"; } my %nu_hash=(); #why is this an empty hash? (is he storing patterns +in a hash?) my $sstr =""; #why is this an empty string? for(my $i=0;$slen>=$i+$pl; $i++) { $sstr=substr($str,$i,$pl); $nu_hash{$sstr}++; } return \%nu_hash; }
i know my question is quite lengthy, but bear with me :-),
In reply to trouble understanding code, and shift() w.o args by DanielM0412
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |