And don't forget the $^E variable, which will give you the OS-specific
error, which can sometimes give you more info on why something failed.

If you're using a Win32 system, you might also want to check out the
Win32::FileOp module which can tie into your built-in Win32 APIs to do
things like copying, renaming, copying directories, deleting full
directories, etc.,etc.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 11:56 AM
To: [EMAIL PROTECTED]
Subject: Re: Newbie Stupid Question!


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]

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

Reply via email to