"I am looking at doing and getting better with oneliners from the command line."

If that's the case, I would highly recommend adding -wMstrict to your one-liners, right after the perl command, like so: perl -wMstrict -insert_other_stuff_here.

It does appear through other responses that you're a beginner really trying to learn, so throwing the switches I've recommended into the mix while you're learning will provide you the benefit of learning both one liners, and the work involved in making full-blown Perl scripts and modules reliable and as trustworthy as possible. You want your code to operate flawlessly under use warnings (an expanded -w) and use strict (-Mstrict). Very few Perl coders trust code without these present.

I know that using one-liners are typically for one-off type things, but for a relative newcomer to the language, a few extra keystrokes across one-liners will get you into the proper mindset so when you want to use them for more advanced things, you'll be able to do so on the fly quickly, and reliably.


In reply to Re: oneliner cat like capability by stevieb
in thread oneliner cat like capability by gradius85

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.