title: How to avoid errors with perl command line parameters and use strict
body: <p>Why is it that my code is not working after I added <code>use strict; use warnings;</code>? Is there a way to make it work?</p>
  
  <p>Previously, the working code is:</p>
  
  <pre><code>#!/usr/bin/perl -s
  print "x: $x\n";
  print "y: $y\n";
  </code></pre>
  
  <p>The command that I ran is <code>perl -s test.pl -x="hello" -y="world"</code>. The output is:</p>
  
  <pre><code>x: hello
  y: world
  </code></pre>
  
  <p>However, after I added <code>use strict; use warnings;</code>, I got the following errors:</p>
  
  <pre><code>Variable "$x" is not imported at test.pl line 4.
  Variable "$y" is not imported at test.pl line 5.
  Global symbol "$x" requires explicit package name at test.pl line 4.
  Global symbol "$y" requires explicit package name at test.pl line 5.
  Execution of test.pl aborted due to compilation errors.
  </code></pre>
  
  <p>I know I need to declare <code>my $x</code> and <code>my $y</code> to fix the 3rd and 4th error. But what does the first 2 errors mean and how do I overcome it?</p>