#! perl -slw
use strict;
{
package NewStdScalar;
require Tie::Scalar;
our @ISA = qw(Tie::StdScalar);
sub FETCH { return ${+shift}++ }
}
package main;
tie my $scalar, 'NewStdScalar';
$scalar=0;
print $scalar; # 0
{
tie my $scalar, 'NewStdScalar';
$scalar = "---"; # ---
print $scalar;
}
print $scalar; # 1
__END__
C:\test>junk34
0
---
1
-
-
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|