use CONSTANT; CONSTANT my $E => 2.73, my $PI => 3.14, my $CREDO => 'The dream of the slave is...to become master and have slaves'; # Oops! Wrong CREDO ;) $CREDO = 'In $$$ we trust!'; # will ERROR out ;) # and U can: print "I still believe that '$CREDO!'\n"; #where package CONSTANT; use Carp; use Exporter; use Tie::Scalar; @ISA = qw(Tie::StdScalar Exporter); @EXPORT = qw(CONSTANT); # sub CONSTANT {my $i=0;tie $_[$i++],__PACKAGE__,$_[$i++] while $i<@_} sub CONSTANT {tie $_[$.++],__PACKAGE__,$_[$.++] while $. < @_} # If you want to know if something is tied somewhere ;) # sub REF {@_ > 1 ? '' : ref tied $_[0] || ref $_[0]} sub STORE {confess "constants are READ ONLY!"}; 1; vess