if you are new to perl try

perl -e "print uc($_) while (<>);" c:/ged/perl files/stuff.txt > c:/ged/perl
files/stuff.bk

-----Original Message-----
From: Ged [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 10:00 AM
To: [EMAIL PROTECTED]
Subject: modifing and writing to a file


Hi all,

I am very new to perl (2 days) but am finding it very rewarding. I have
however stumbled across a problem hopefully somebody can help me with.

I am trying to open a file, change the text from lowercase to uppercase and
rewrite it to a backup file. However, I only seem to be duplicating the
original file. Here is my code:

$stuff="c:/ged/perl files/stuff.txt";
$backup="c:/ged/perl files/stuff.bk";

open STUFF, $stuff or die "Cannot open $stuff for read :$!";
open BACKUP, ">$backup" or die "Cannot open $backup for write :$!";

while (<STUFF>) {
        s/a-z/A-Z/g;
        print BACKUP "$_";
}

can anyone see where I am going wrong.

Thanks,

Ged.

-----------------------------------------
Email provided by http://www.ntlhome.com/



-- 
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