On Nov 5, 7:45 pm, [EMAIL PROTECTED] (Beach Cruise) wrote:
> I have an interesting issue that I am not able to seem to get around.
>
> I have a function in a lib that we use that has two referenced
> hashes.
>
> ....
> my $zone   = $self->{'zone'};
> my $params = $self->{'report-params'};
> my %zone_list = ();
>
> $count = $zone->generate_zone_list(\%zone_list,\%params);

Where did %params come from?  There is no such variable above.  Are
you not using strict (which would tell you when you use an undeclared
variable), or are you not showing us a relevant piece of your code?

%params and $params have absolutely nothing to do with each other.  At
all.   If $params is a reference to a hash, and you want to pass a
reference to that hash, just pass the reference you already have:
$count = $zone->generate_zone_list(\%zone_list, $params);

> sub generate_zone_list {
>         my ($self,$results_hash,$params) = @_;
>
>         my $sched_id = %{$params}->scheduleId();

This is wrong syntax.  I'm shocked (and disturbed) it works at all.
It should be:
$params->scheduleId();

>         my $filekey      = $filekey.$sched_id;

This makes no sense.  You're declaring a variable on the left and
assigning it to be a string that results in part from the
concatenation of that variable on the right.  When the right side of
this is evaluated, $filekey does not exist (and therefore has no
value).  Again, strict would tell you when you make mistakes like
this.

>         my $temp_file     = "/tmp/.bw3-temp-${filekey}.tmp";
>         return $temp_file;

I don't understand the point of creating and storing a variable only
to then immediately return it.  Why not just return the value itself?

return "/tmp/.bw3-temp-$filekey.tmp";

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to