gurpreetsingh13:

They think everything should be in perl itself and think that pure perl can take them to the other side.

Untrue--there are numerous articles where people suggested just using a command line operation instead of writing a perl script. I've done so a few times myself.

We have a unix system and should recognize the power of that OS which has been there since 30 years ago. What is the problem there in shipping out something to shell when the work gets done easily.

Many of us here are Unix-centric and have no problem shelling out for some tasks. But the way I read the situation is more like this:

Hippo: Why are you using the cutting blade of your swiss-army knife to remove that screw? You know it has a couple screwdriver blades, right?
gurpreetsingh13: That's the problem I have with you guys...knife blades are perfectly capable of opening paint cans, removing screws, driving nails. You don't need all those other fancy attachments.

Hmmm ... okay. Or maybe a better analogy might be this:

Hippo: You're trying to drive a nail with a chainsaw. Are you sure you really need the chainsaw to be running while you're doing that? Seems a bit iffy.
gurpreetsingh13: But chainsaws are powerful tools! Why not use them?

But ... the blood ... the detached limbs ... possible severed heads ...

But since this code is workable (tested few times on my home directory), so I had to put that rm -rf there.

Just because you tested it in your home directory, doesn't make it require -rf. But I'm guessing you didn't test it in your home directory, unless you (a) just created a brand-new virtual machine to run it under, (b) just created a new account to run it under, (c) had spaces in the names of all your important files and directory names, or (d) didn't have any important files anyway.

This is a simple script and we can forget about execution speed here.Any intelligent guy would never run the script without reading the code.

True, instead he'd delete the script and then run away screaming. That's a pretty scary script to have on your system. If you happened to be in the wrong directory and ran it, your first clue to a problem might be something like:

bash: stat: command not found

showing up after a couple minutes of disk thrashing. Since it helpfully provides -r, it could merrily wreak havok on the filesystem ... at least until enough programs died that the script would fail.

While I agree that shelling out to other programs to solve a problem is fine, it pains me to see:

hippo raised a couple issues with the script, but your dismissal of those issues is rather peremptory.

Update: A couple fixes: s/amputations/limbs/, changed a ? to a !.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re^4: removing files with perl based on age and name by roboticus
in thread removing files with perl based on age and name by Jocqui

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.