[Pdx-pm] error: Can't use string ("Workrequest::Utilities") as a HASH ref

Tom Keller kellert at ohsu.edu
Thu Jan 12 17:01:59 PST 2012


Greetings,
Writing a module Workrequest::Utilities with subroutine
##### code snippet ######
sub sample_range_fix {
my $params_ref = shift;
my $samples;
my $filename = $params_ref->{filename};
my $start = $params_ref->{start};
my $count = $params_ref->{count};
my $prefix = $params_ref->{prefix};
my $last = $start + $count -1;

for my $c ($start .. $last -1) {
if ( $c < 10 ) {
my $number = "0$c";
$samples .= "${prefix}_$number, ";
} else {
my $number = "$c";
$samples .= "${prefix}_$number, ";
}
$c++;
}
# add last sample w/o a comma
if ( $count < 10 ) {
$samples .= "${prefix}_0$last";
} else {
$samples .= "${prefix}_$last";
}
return $samples
}
##### end code snippet ######

I get the strict ref error when I call this method with:
##### code snippet ######
my %params = (
filename => $filename,
start => $start,
count => $count,
prefix => $prefix
);
my $samples = Workrequest::Utilities->sample_range_fix( %params );
##### end code snippet ######

I can't see what's wrong with it. Can you?

thanks for your help,
Tom
MMI DNA Services Core Facility<http://www.ohsu.edu/xd/research/research-cores/dna-analysis/>
503-494-2442
kellert at ohsu.edu<http://ohsu.edu>
Office: 6588 RJH (CROET/BasicScience)

OHSU Shared Resources<http://www.ohsu.edu/xd/research/research-cores/index.cfm>






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/pdx-pm-list/attachments/20120112/5340f82f/attachment.html>


More information about the Pdx-pm-list mailing list