Is using strict with an empty list equivalent to not using strict at all?
<p>TLDR: See question title.</p>

<p>In the <a href="https://stackoverflow.com/revisions/40400444/1">original version of a question</a>, there was <code>use strict ();</code> at the top of the program. No variables were declared with <code>my</code>. The program worked. I pointed that out that the code wouldn't work because of the missing <code>my</code>s, but it turns out I was mistaken.</p>

<pre><code>$ perl e 'use strict (); $foo = 1'
</code></pre>

<p>This program works. It doesn't crash. But obviously this crashes:</p>

<pre><code>$ perl -e 'use strict; $foo = 1'
Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?) at -e line 1.
Execution of -e aborted due to compilation errors.
</code></pre>

<p>My first idea was to deparse it to see if something else is going on.</p>

<pre><code>$ perl -MO=Deparse -e 'use strict (); $foo = 1'
use strict ();
$foo = 1;
-e syntax OK
</code></pre>

<p>But it's not. Then it got me thinking, you can do <code>use strict 'vars'</code>, which <em>only</em> turns on the vars <em>thing</em><sup>1</sup>. It obviously does that by calling <a href="https://metacpan.org/source/RJBS/perl-5.24.0/lib/strict.pm#L62" rel="nofollow noreferrer"><code>import</code></a>. </p>

<p>The <code>use strict</code> is the same as <code>BEGIN { require strict; strict-&gt;import; }</code>, so the same rule that goes for modules should apply for pragmata too. If I do <code>use Foo ()</code>, nothing is imported. Hence, <code>use strict ();</code> should be the same as <code>require strict;</code>, just at run time, because nothing is imported.</p>

<pre><code>$ perl -e 'require strict; $foo = 1'
</code></pre>

<p>This doesn't crash. But then at runtime you cannot turn on stuff that is supposed to be set at compile time.</p>

<p>So what does this actually do? When Perl reaches my actual code, it probably already encountered the <code>strict</code> pragma somewhere else, so it wouldn't load it again. And it doesn't import anything.</p>

<pre><code>$ perl -e 'print %INC'
</code></pre>

<p>Oops. This prints nothing. <code>%INC</code> is empty. But if we use another module, there is something in it.</p>

<pre><code>$ perl -MData::Dumper -e 'print Dumper \%INC'
$VAR1 = {
          'warnings.pm' =&gt; '/usr/share/perl/5.22/warnings.pm',
          'overload.pm' =&gt; '/usr/share/perl/5.22/overload.pm',
          'Carp.pm' =&gt; '/usr/share/perl/5.22/Carp.pm',
          'strict.pm' =&gt; '/usr/share/perl/5.22/strict.pm',
          'overloading.pm' =&gt; '/usr/share/perl/5.22/overloading.pm',
          'constant.pm' =&gt; '/usr/share/perl/5.22/constant.pm',
          'bytes.pm' =&gt; '/usr/share/perl/5.22/bytes.pm',
          'Data/Dumper.pm' =&gt; '/usr/lib/x86_64-linux-gnu/perl/5.22/Data/Dumper.pm',
          'XSLoader.pm' =&gt; '/usr/share/perl/5.22/XSLoader.pm',
          'Exporter.pm' =&gt; '/usr/share/perl/5.22/Exporter.pm',
          'warnings/register.pm' =&gt; '/usr/share/perl/5.22/warnings/register.pm'
        };
</code></pre>

<p>If we load Data::Dumper, <code>strict</code> was loaded at some point. But not in the pure <code>-e</code> example.</p>

<pre><code>$ perl -e 'use strict (); print %INC'
strict.pm/usr/share/perl/5.22/strict.pm
</code></pre>

<p>Ok. This loads strict.pm.</p>

<pre><code>$ perl -e 'require strict; print %INC'
strict.pm/usr/share/perl/5.22/strict.pm
</code></pre>

<p>So does that. But still, none of the <code>strict</code> things are enabled.</p>

<p>So the question really is, is <code>use strict ()</code> equivalent to just not having a <code>use strict</code> statement at all, or is there something else happening?</p>

<hr>

<p><sup>1) <a href="http://perldoc.perl.org/strict.html" rel="nofollow noreferrer">perldoc strict</a> refers to the three different arguments <code>strict</code> can take as <em>things</em></sup></p>