On Mon, Jul 15, 2002 at 01:35:15PM -0500, Akens, Anthony wrote:
> On an unrelated note, something that is an immense help to me when using
> "or die" is to put $! in the die statement, for example:
> 
> or die "Can't open documents: $!";
> 
> The $! inserts the "human readable" error returned by the system, such as
> "permission denied" or "file not found" which can help a lot in figuring out
> what's broke.

Absolutely!  Often a great timesaver.

> From: Simopoulos [mailto:[EMAIL PROTECTED]]
> Subject: Newbie Stupid Question!
> 
> 
> Hi All,
> I'm a newbie just starting out learning Perl.
> My problem is I have a bunch of files that are (.doc) files, and I want to rename
> the files (.data).
> I also want move then to another directory, but I don't really want to destroy or
> change the old ones (.doc).

Life has become a lot easier for me since learning about the rename command.
You could copy the .doc files to your new directory and then run rename on
those to change the name:

mkdir new
cp *.doc new
cd new
rename 's/.doc$/.data/' *

Or something along those lines...

Chris

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to