Try this patch, which may only apply cleanly to a recent bleadperl (I'm at patchlevel 13599). Don't forget to run embed.pl after you do. The new -N switch adds this loop around your script:
LINE: while (<DATA>) { }
It should doesn't break any of the regression tests. It may break binary compatibility. Use at your own risk. Try this demonstration:
#!/usr/bin/perl -wNp use strict; $_ = reverse $_; __DATA__ citamorhc si !sdrawkcab
Merry Christmas!
--- ~intrpvar.h Tue Dec 11 13:20:28 2001 +++ intrpvar.h Tue Dec 11 13:20:41 2001 @@ -27,6 +27,7 @@ PERLVARI(Isplitstr, char *, " ") PERLVAR(Ipreprocess, bool) PERLVAR(Iminus_n, bool) +PERLVAR(Iminus_N, bool) PERLVAR(Iminus_p, bool) PERLVAR(Iminus_l, bool) PERLVAR(Iminus_a, bool) --- ~perl.c Tue Dec 11 13:13:15 2001 +++ perl.c Wed Dec 12 11:16:14 2001 @@ -1087,6 +1087,7 @@ case 'M': case 'm': case 'n': + case 'N': case 'p': case 's': case 'u': @@ -2135,6 +2136,7 @@ "-l[octal] enable line ending processing, specifies line termin +ator", "-[mM][-]module execute `use/no module...' before executing program" +, "-n assume 'while (<>) { ... }' loop around program", +"-N assume 'while (<DATA>) { ... }' loop around program" +, "-p assume loop like -n but print line also, like sed", "-P run program through C preprocessor before compilatio +n", "-s enable rudimentary parsing for switches after progra +mfile", @@ -2361,6 +2363,11 @@ Perl_croak(aTHX_ "No space allowed after -%c", *(s-1)); return s; case 'n': + PL_minus_n = TRUE; + s++; + return s; + case 'N': + PL_minus_N = TRUE; PL_minus_n = TRUE; s++; return s; --- ~sv.c Tue Dec 11 13:19:16 2001 +++ sv.c Tue Dec 11 13:19:33 2001 @@ -9825,6 +9825,7 @@ PL_splitstr = proto_perl->Isplitstr; PL_preprocess = proto_perl->Ipreprocess; PL_minus_n = proto_perl->Iminus_n; + PL_minus_N = proto_perl->Iminus_N; PL_minus_p = proto_perl->Iminus_p; PL_minus_l = proto_perl->Iminus_l; PL_minus_a = proto_perl->Iminus_a; --- ~toke.c Tue Dec 11 13:14:33 2001 +++ toke.c Tue Dec 11 13:32:02 2001 @@ -2435,7 +2435,11 @@ PL_preambleav = NULL; } if (PL_minus_n || PL_minus_p) { - sv_catpv(PL_linestr, "LINE: while (<>) {"); + if (PL_minus_N) { + sv_catpv(PL_linestr, "LINE: while (<DATA>) {"); + } else { + sv_catpv(PL_linestr, "LINE: while (<>) {"); + } if (PL_minus_l) sv_catpv(PL_linestr,"chomp;"); if (PL_minus_a) {
Update: (Wed Dec 12 18:20:00 UTC 2001) I missed a couple of spots in perl.c. They've been added to the patch above. They're the first two chunks in that file, and now it works from the command line.

In reply to Re: A little Christmas switch wish.. by chromatic
in thread A little Christmas switch wish.. by demerphq

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.