s/a-z/A-Z/g should be s/[a-z]/[A-Z]/g;

You also use uc function like this :
print BACKUP uc "$_";
#or
#print BACKUP uc ; 

C:\>perldoc -f uc
    uc EXPR
    uc      Returns an uppercased version of EXPR. This is the internal
            function implementing the "\U" escape in double-quoted
strings.
            Respects current LC_CTYPE locale if "use locale" in force.
See
            the perllocale manpage. Under Unicode ("use utf8") it uses
the
            standard Unicode uppercase mappings. (It does not attempt to
do
            titlecase mapping on initial letters. See "ucfirst" for
that.)

            If EXPR is omitted, uses "$_".


C:\>

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



**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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

Reply via email to