In the last couple of days I have been wondering (again) what do people write in UNIX shell scripts and how could those be implemented in Perl? In which cases is shell preferable to Perl?

As I have not written many shell scripts in my life I tried to look for some examples and bumped into the Wicked Cool Shell Scripts. I thought it would be cool (and wicked) to implement them in Perl.

So I started to do it but while each one is relatively simple doing all 101 is quite a lot of work. Dear Monks, please help me translating them. Pick one of the scripts, implement it in Perl and post it here.

Let me start with the first script....

Update: strangely I did not find earlier a book with the title: Wicked Cool Perl Scripts that was pointed out by planetscape so I retitled the node. Unfortunatelly I cannot seem to find the scripts from this book but that would not be related to my question anyway.


In reply to Wicked Cool Shell Scripts implemented in Perl by szabgab

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.