Perl keeps impressing me (negatively) with weird stuff such as implicit context and so on....
but that one is really out of the ordinary...
prompt~/ perl
print "-------\n\n";
my $x = 'hostname1.foo.net';
$x->{'datacenter'} ||= '__';
use Data::Dumper;
print Dumper $x;
print "x".$x->{'datacenter'}."x\n";
my $y = 'hostname1.foo.neT';
print "y".$y->{'datacenter'}."y\n";
my $z = 'hostname1.foo.net';
print "z".$z->{'datacenter'}."z\n";
-------
$VAR1 = 'hostname1.foo.net';
x__x
yy
z__z
prompt~/
first, I thought calling ->{} on a scalar/string would crash. to my surprise, my program passed. so I wrote this test only to learning something even crazier about perl. couldn't this be a security issue?
