in reply to Problem with "use constant" and UDP socket connection

As Fletch points out, constants are supposed to be, well, constant. Something that varies is called a variable. Perhaps what you want is a subroutine that returns the current value of your variable? This would let you use it like the constant, but without all the weird contortions:

my $foo; sub FOO () { $foo } $foo = 1; print FOO, "\n"; $foo = 2; print FOO, "\n";