Your problem is that you're calling
nucleotide_count as a “class method”. More concretely, when you call a method like
RECEIVER->method, the
method call gets
RECEIVER as its first argument. The
nucleotide_count code expects an instance of class
analysis (which would be a hashref), but instead it's getting the string
analysis itself (which is not a hashref). To fix this, call
my $thingy = analysis->new with appropriate arguments, and then use
$thingy->nucleotide_count instead.
UPDATE: Oops, sorry, f00li5h beat me to it. Incidentally, note that good practice when posting questions like this is to try to strip the code down to as small as possible an example that still exhibits your error—it's a lot easier to get someone to look at 5 lines than a full program.