http://qs1969.pair.com?node_id=210435


in reply to Re: remove backups
in thread remove backups

... 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)},"