I sent a colleague a perl script, wrapped in my standard Perl polyglot, and named with a .cmd extension, so that it can easily be run from the Windows command line. This is the wrapper I use, which is based on bat2pl from the ActiveState Perl installation:
@rem = '--*-Perl-*-- @echo off perl "%~dpnx0" %* goto endofperl @rem '; #!perl #line 8 use strict; use warnings; # perl code goes here __END__ :endofperl
This runs as a batch, and line 3 calls perl with the batch file's full drive, path, name, and extension (that's the %~dpnx0) as the first parameter, and then all other parameters appended after.

She reported back to me that after installing ActiveState Perl 5.8.1.807, she gets the following error:

Name "main::rem" used only once: possible typo at E:/.../csvsplit.cmd +line 1.
I experimented on my machine, and I could make it do this by putting -w in the perl statement on line 3, and then fix it again by putting -wx in, so I advised her to put -x in the call thus:
perl -x "%~dpnx0" %*
Any ideas why her installation gives this error, and mine (same ActiveState version) doesn't?

In reply to Perl Polyglot Problem by PhilHibbs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.