How come the following perl code,
mkdir("foo");
print "foo: $!\n";
mkdir("foo");
print "foo: $!\n";
Will output the following (in a directory without a foo)
perl ./asdf.pl
foo:
foo: File exists
But removing foo, the following
$ perl <<EOF
mkdir("foo");
print "foo: $!\n";
mkdir("foo");
print "foo: $!\n";
EOF
Swallows the error and outputs,
foo:
foo: