And what about the
for
statement. Is it used for for looping? Usually the syntax is
for( ; ; );
Is this an alternate way of using it?
• 0 views
•
link
I need help regarding a perl code that was used to count the numbr of bases. I am aware of the function of cat and grep commands here. But the perl portion of the code is a bit puzzling.
> cat chr22_with_ERCC92.fa | grep -v ">" | perl -ne 'chomp $_; $bases{$_}++ for split //; if (eof){print "$_ $bases{$_}\n" for sort keys %bases}'
chomp removes the end of line character
split // splits the string into characters that are added to the hash with $bases{$_}++ whilst incrementing with ++.
The for is for looping through the array which is produced by split //
Then if you reach the end of the file eof you sort the hash and print the character $_ followed by its value/count $bases{$_}
And what about the
for
statement. Is it used for for looping? Usually the syntax is
for( ; ; );
Is this an alternate way of using it?
Log in to answer this question.