On Apr 19, Hawkes, Mick I said:

But back to the original question. I need to put a lot of re-occurring code into subroutines (as you do) however I am hampered to a problem with passing shift I think. This is a very simplified test code where I have tried passing shift as an argument and also as a call (see commented out bits) both give the same error:

"Error executing run mode 'mode_0': can't call method "param" on an undefined value at test_code.pm line 57

That's because you DIDN'T PASS ANYTHING to the GetOfficers() function.

sub mainmenu
{
 my $self = shift;
#  my @loop = GetOfficers($self);
 my @loop = GetOfficers();
}

You should be doing:

  my @loop = GetOfficers($self);

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

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




Reply via email to