Last active
June 22, 2017 10:02
-
-
Save sng2c/2c3a1b144b837d31aae781396fcd2bb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.10; | |
sub ok{ | |
print $_[0]?"OK":"FAIL"; | |
print "\n"; | |
} | |
sub make_sym{ | |
state %symbols; | |
my ($sym) = @_; | |
$symbols{$sym} = \$sym unless $symbols{$sym}; | |
return $symbols{$sym}; | |
} | |
my $SYM1 = make_sym("TEST1"); | |
my $SYM2 = make_sym("TEST2"); | |
my $SYM3 = make_sym("TEST1"); | |
ok($SYM1!=$SYM2); | |
ok($SYM1==$SYM3); | |
ok($SYM1 ne $SYM2); | |
ok($SYM1 eq $SYM3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment