HEX
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: u108027308 (833300)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: //usr/share/doc/libvariable-magic-perl/examples/copy.pl
#!/usr/bin/perl

use strict;
use warnings;

use lib qw<blib/arch blib/lib>;
use Variable::Magic qw<wizard cast>;
use Tie::Hash;

my $wiz = wizard copy => sub { print STDERR "COPY $_[2] => $_[3]\n" },
                 free => sub { print STDERR "FREE\n" };
my %h;
tie %h, 'Tie::StdHash';
%h = (a => 1, b => 2);
cast %h, $wiz;
$h{b} = 3;
my $x = delete $h{b};
$x == 3 or die 'incorrect';