[Pdx-pm] Pass by reference(?)

Roderick A. Anderson raanders at acm.org
Tue Mar 23 16:54:08 CST 2004

I think I've got the correct terms but a very weak understanding.

I'm using HTML:Template to fill in some HTML (go figure) and XML 
templates.  I use a hash to hold the template variables and then use this 

    my $add_plans = HTML::Template->new(
            filename => "$TemplateDIR/$Template",
            die_on_bad_params => 0);

    foreach my $key (keys %SUI) {
        $add_plans->param($key => $SUI{$key});

And though it's only 2 lines of code it goes (to my way of thought) 
against the grain.  I'd like to do something like a fill_form subroutine 
that I could call.  The hash (%SUI) is global (main) but $add_plans is 
local to the subroutine it is in.
   So my question(s) are how to call the sub and how to access the 

   My thoughts are 

	&fill_form(\$add_plans, %SUI); 

   I do realize I can get by without passing the %SUI since it's global 
but it seems good form and probably should be \%SUI with then the 
subroutine would be completely generic.

But I'm completely out of my depth when it comes to the actual
subroutine and how to get at $add_plans and if I need any special magic to
return it.

As always any and all help, pointers and clue-stick are appreciate.

    "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware}* PostgreSQL"

* My middleware looks like perl, smells like perl, and feels like perl.  
  Heck it must be right.

More information about the Pdx-pm-list mailing list