Actualy, what you did is not a hash, but three scalars - and yes, that would work. To
use a hash SLICE local to the subroutine, you would do it like this:
sub sonic
{
my %lh;
@lh{qw(numhits maxhits hits)} = @_;
...
}
After that, you could refer to the values locally as:
$lh{numhits}
$lh{maxhits} and
$lh{hits}
Just a note. Your method would work, but it was not a hash.
Steve H.
-----Original Message-----
From: Mike Rapuano [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 05, 2001 3:40 PM
To: Paul Johnson; Birgit Kellner
Cc: [EMAIL PROTECTED]
Subject: RE: passing values to sub
I'm just a beginnner BUT why not use HashRef for the @hits array to make
all data going to sub sonic a scalar values
Then sub sonic would be...
sub sonic
{
my ($numhits, $maxhits, $hits) = @_;
...
}
YOu would just need to deference the reference.
MIke
-----Original Message-----
From: Paul Johnson
Sent: Sun 8/5/2001 4:33 PM
To: Birgit Kellner
Cc: [EMAIL PROTECTED]
Subject: Re: passing values to sub
On Sun, Aug 05, 2001 at 10:15:09PM +0200, Birgit Kellner wrote:
> --On Sonntag, 05. August 2001 19:51 +0200 Paul Johnson
<[EMAIL PROTECTED]>
> wrote:
>
> > html_record($numhits, $maxhits, @hits);
> >
> I had figured that much, but got stuck on the other end: The
sub in the
> second file, config.pl, does not get these values. With
> my @hits = @_;
> I get the content of @hits all right, but how do I get
$numhits and
> $maxhits?
sub sonic
{
my ($numhits, $maxhits, @hits) = @_;
...
}
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]