use strict; # hacksym('name', ref) # e.g. hacksym('foo', \@bar) makes @foo an alias for @bar sub hacksym { my $name = shift; my $ref = shift || die "need a reference!"; no warnings 'uninitialized'; no strict 'refs'; *{$name} = $ref; } #### package Bling; use strict qw(vars subs); use warnings; # simply put: use Bling; then, whenever your script accesses $$, # it prints 'Bling Bling!!'. my $ref; sub import { unless (defined $ref) { $ref = \${'main::$'}; undef *{'main::$'}; # tramples @$ and %$. I really don't care. tie ${'main::$'}, 'Bling::Bling'; } } sub unimport { if (defined $ref) { untie ${'main::$'}; *{'main::$'} = $ref; undef $ref; } } package Bling::Bling; sub TIESCALAR { bless [], shift; } sub FETCH { local $\; print "Bling Bling!!\n"; $$ref; } 1; #### #!/usr/bin/perl -l # blingtest.pl use Bling; $x=$$; print '$x is ', $x; { no Bling; $y=$$; print '$y is ', $y; } print '$$ is ', $$; #### $"=$,,$_=q>|\p4<6 8p .q>.<4-KI;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/