title: How do I best pass arguments to a Perl one-liner?
body: <p>I have a file, <code>someFile</code>, like this:</p>
  
  <pre><code>$cat someFile
  hdisk1 active
  hdisk2 active
  </code></pre>
  
  <p>I use this shell script to check:</p>
  
  <pre><code>$cat a.sh
  #!/usr/bin/ksh
  for d in 1 2
  do
      grep -q "hdisk$d" someFile &amp;&amp; echo "$d : ok"
  done
  </code></pre>
  
  <p>I am trying to convert it to Perl:</p>
  
  <pre><code>$cat b.sh
  #!/usr/bin/ksh
  export d
  for d in 1 2
  do
      cat someFile | perl -lane 'BEGIN{$d=$ENV{'d'};} print "$d: OK" if /hdisk$d\s+/'
  done
  </code></pre>
  
  <p>I export the variable <code>d</code> in the shell script and get the value using <code>%ENV</code> in Perl. Is there a better way of passing this value to the Perl one-liner?</p>