Create an object/Native demonstration: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: future-proof for 5.36, explicit :prototype) |
||
Line 668: | Line 668: | ||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
<syntaxhighlight lang="perl"> |
<syntaxhighlight lang="perl">use strict; |
||
⚫ | |||
package LockedHash; |
|||
⚫ | |||
use Carp; |
use Carp; |
||
use strict; |
|||
sub TIEHASH { |
sub TIEHASH { |
||
Line 711: | Line 712: | ||
} |
} |
||
sub lock_hash(\%) { |
sub lock_hash :prototype(\%) { |
||
my $ref = shift; |
my $ref = shift; |
||
tie(%$ref, __PACKAGE__, %$ref); |
tie(%$ref, __PACKAGE__, %$ref); |