--On Sonntag, 05. August 2001 19:51 +0200 Paul Johnson <[EMAIL PROTECTED]> 
wrote:

> On Sun, Aug 05, 2001 at 07:27:25PM +0200, Birgit Kellner wrote:
>> I have two files called html.pl and config.pl, both of which require
>> each  other.
>>
>> The subroutine &html_record is contained in the other file, config.pl. I
>> want to make the array @hits as well as the values of $numhits and
>> $maxhits  available to that sub. I know that it works when I
>> "de-privatize" the  variables, i.e. remove the "my" and the parentheses
>> from the above code.  But I don't understand enough of perl to figure
>> out (a) whether this is a  good idea memory-, speed- & style-wise and
>> (b) whether there might be a  different way. Note that I won't be
>> needing the variable values anymore in  other subs in html.pl (which,
>> er, is why they were originally declared as  private variables).
>
>> in html.pl, a subroutine starts like this:
>> my (@hits) = @_;
>> my ($numhits) = ($#hits+1) / ($#db_cols+1);
>
> There is no need for parentheses around $numhits.

Thank you very much for cleaning up my code.

> 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?

Birgit Kellner




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to