in reply to remove backups

Hmmm...


Just some friendly critique

SMiTZ

Update: I Sir, am a plonker.

Replies are listed 'Best First'.
Re: Re: remove backups
by Sidhekin (Priest) on Nov 05, 2002 at 12:07 UTC

    ... chomp $dirname - why?

    To get rid of that pesky newline. (Yes, there is one.)

    ... define the scalar $dirname - why?

    That he may print it (in the last line)?

    ... use a system call to rm, making it platform dependant. Why not use unlink?

    Opening "ls *~|" already makes it platform dependent. Of course, that could be glob("*~"), so your question still stands ...

    ... empty the entire directory from which this is run - why not use rm * | del *.* | whatever?

    I think you miss the point: the alternative would be rm *~, which is quite easy to get wrong. Or at least easy enough to make guys like me paranoid.

    Me, I have a bash function for this sort of thing:

    function cleanup { rm "$@" *~ .*~ #* }

    If it ever gets complicated enough that I make a Perl script out of it, I'll probably make it platform independant. For now, it does the job.

    The Sidhekin
    print "Just another Perl ${\(trickster and hacker)},"

      Undeserved Abbots are quick to reply, slow to think. Of course pwd is a command, not a directory name. The backticks should have given it away, but its one of those days|weeks|lives.
      Apologies to pfm, you know where the -- button is...

      SMiTZ