Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I'm new here and finally have a question that I couldn't find and answer to (a first). Can anyone point me to some resources/documentation/tutorials etc on perl one-liners?
Well, a few other monks already gave you some answers addressing exactly your question. As an example of a one-liner I routinely use I'll give:
perl -lpi.bak -e "" <file(s)>
under Windows to convert from *NIX-style \n's to Redmondish ones (yes, I know there are tons other WTDI both in Perl and with other tools - but this way I don't even have to remember which is which).

The -i.bak is there because under Windows (at least 98 or earlier, that is, and if things have not changed recently) you can't have -i without backups...

I have picked up some things here and there, but would like better explanations on what the options like -pie, pack and alike do and what they are for.
The answer to all of these question is out there, in the docs: please check
perldoc pelrun
perldoc -f pack
perldoc perlpacktut

Please note that in certain environments the kind of answer such a question would get could be at best an educated RTFM.

However I would like to point out that while indeed -pie has to do with one-liners, pack() is yet another Perl function, so you can use it in a one-liner, granted; but I don't see how it can be strictly related to your question (however I hope the tutorial above will help you).

In any case -pie is just the same as -p -i -e: -p adds a loop around your program, that is given on the cmd line itself by means of -e and finally -i does inline editing. You can check by yourself what -p adds to your code:

$ perl -MO=Deparse, -pe '' LINE: while (defined($_ = <ARGV>)) { (); } continue { print $_; } -e syntax OK

In reply to Re: One Liners by blazar
in thread One Liners by lakeTrout

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!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (4)
    As of 2015-07-05 08:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (61 votes), past polls