After rolling a FORMAT oneliner! :) I echo'd this into a file. Now my laziness is starting to niggle and I decide it is about time to edit in place those semicolons into newlines rather than doing this manually.

After clobbering the file a number of times. I could not get a 'simple' s/// or tr/// to operate on a perl -ni -e command. I eventually split the looping stdin file at the semi-colons and joined with newlines, and this was fine. But I wonder why I wasn't able to s/// or y/// on a looping file? some examples:

file to which one-liner echo'd

#! \usr\bin\perl use strict; use warnings; "my $fs = q!.\funkisym.pm!;open(FUNKISYM, q(>),qq($fs)); my $flashbang + = q{#! \usr\bin\perl};my $pra = q!use strict;!; my $pra2 = q!use war +nings;!;my @fstr = (q(format FUNKISYM = ),q(@).q(<) x 16,q($flashban +g).qq(\n),q(@).q(<) x 11,q($pra),q(@).q(<) x 13,q($pra2),qq(.\n));eva +l(join($/,@fstr));select FUNKISYM;write;exec(qq!notepad\.exe $fs!);"

attempted commands which either clobbered file and/or produced bareword deaths on tr///

perl -n -i.bak -e "tr/;/\n/;" .\funkisym.pm perl -n -i.bak -e "y/\Q;\E/\n/;" .\funkisym.pm perl -n -i.bak -e "s/(;)/$1\n/g;" .\funkisym.pm

I tried variations further to those shown, and settled for the following solution;

perl -ni.bak -e "my @text = split(q{;});print join(qq(;$/), @text);" . +\funkisym.pm"

Please can you suggest what I may be assuming incorrectly, in relation to this problem?


In reply to s/// + tr/// when perl -ni -e on semi-colons in one liners echoed to files by Don Coyote

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.