Perl Problem mit Hashes
Andre Landwehr
andre.landwehr at gmx.net
Fri Jan 26 20:59:53 CET 2001
On Fri, Jan 26, 2001 at 08:14:20PM +0100, Alexander Reelsen wrote:
> sub ca { %tmp = %{$_[0]} ; ${$tmp}{i}++ };
> $id{i} = 5 ;
> ca \%id;
> print "$id{i}\n"
>
> Das Problem ist, dass "${$tmp}{i}++" keine �nderung im Hash bewirkt. Wie
> also hat dieser Aufruf zu lauten. Oder habe ich mich irgendwie verrannt
> und das ganze funktioniert so gar nicht, oder habe ich schlichtweg was
> uebersehen?
soviel erstmal vorweg: Durch
sub ca { %tmp = %{$_[0]} ; ${$tmp}{i}++ };
^^^
legst du eine Kopie des Hashes an, auf den die Referenz in $_[0]
verweist... ich bastle weiter...
Andre
--
/"\
\ /
X ASCII Ribbon campaign against HTML E-Mail
/ \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20010126/fd1ee696/attachment.sig>
More information about the Linux
mailing list