in reply to Subroutine arguments problem
However, I also see the following in your queryProcesses() subroutine:sub queryProcesses { my $server = shift;
That suggests that you may need to rethink your code. You probably wanted $server to be declared global, or better yet, have the subroutine return a reference to the hash.if ($processTableRecord->fname eq $server) { %{$server} = ( pid => '$processTableRecord->pid', server => '$processTableRecord->fname' ); print $processTableRecord->uid, "\n"; }
Last issue:
Single quotes will cause the whatever is in the quotes to not be interpolated. From what I see, I suspect that you probably just want to drop the quotes. If you do, don't just change them to double quotes as double quotes do not allow for interpolations of subs or object methods. I'd probably write that bit as follows (note that I changed the parentheses to braces to create the hashref):pid => '$processTableRecord->pid',
$server = { pid => $processTableRecord->pid, server => $processTableRecord->fname };
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Subroutine arguments problem
by dpatrick (Scribe) on May 03, 2001 at 22:50 UTC |