| Server IP : 167.99.254.82 / Your IP : 216.73.216.188 Web Server : Apache System : Linux host.techisquad.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/libvariable-magic-perl/examples/ |
Upload File : |
#!/usr/bin/perl
use strict;
use warnings;
use lib qw<blib/arch blib/lib>;
use Variable::Magic qw<wizard cast dispell>;
my $wiz = wizard
fetch => sub { print STDERR "$_[0] FETCH KEY $_[2]\n" },
store => sub { print STDERR "$_[0] STORE KEY $_[2]\n" },
'exists' => sub { print STDERR "$_[0] EXISTS KEY $_[2]\n" },
'delete' => sub { print STDERR "$_[0] DELETE KEY $_[2]\n" };
my %h = (foo => 1, bar => 2);
cast %h, $wiz;
print STDERR "foo was $h{foo}\n";
$h{foo} = 3;
print STDERR "now foo is $h{foo}\n";
print STDERR "foo exists!\n" if exists $h{foo};
my $d = delete $h{foo};
print STDERR "foo deleted, got $d\n";
dispell %h, $wiz;