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?

about {{count}} hours later:
You hit what is called a symbolic reference. It is a very powerful feature of Perl that if written unintentionally, can easily trip even the most experienced Perl programmers.
To avoid accidental usage of that feature, the recommended way to write perl code is to start it with:
use strict;
Try to save your code in a file and precede it with the use strict; statement That will trigger a run time error:
Can't use string ("hostname1.foo.net") as a HASH ref while "strict refs" in use at a.pl line 5.
about {{count}} hours later:
Better yet, write
That second line will give you all kinds of run-time warnings that indicate issues with your code.