Robin Sheat wrote:
> 
> I have a method 'getNetwork' that returns a hash.

Actually, subroutines in perl return lists.

> I can quite happily go:
> %reply = $network->getNetworkError('net','data','data2');
> my $baseErr = $reply{error};
> 
> however, I can't go:
> my $baseErr = $network->getNetworkError('net','data','data2')->{error};
> nor:
> my $baseErr = ${$network->getNetworkError('net','data','data2')}{error};
> why not? And is there any way to do this in one line?

You have to convert the list so that the hash key can be extracted.

my $baseErr = { $network->getNetworkError('net','data','data2') }->{error};


John
-- 
use Perl;
program
fulfillment

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