Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: convert a Unicode file to Ansi, using filehandle..

by markuhs (Scribe)
on Nov 06, 2009 at 07:08 UTC ( #805417=note: print w/ replies, xml ) Need Help??


in reply to convert a Unicode file to Ansi, using filehandle..

Hi, welcome to perlmonks!

First of all: use strict; and use warnings; is great!
This would tell you, that "Global symbol "$Temp" requires explicit package name".
Second: use autodie; or add another or die $!; to line 4.

Why do you open the file twice? You should at least close the filehandle before opening it again.
Closing it before writing to it, does not work either!
Oh, now I understand!!! You use the same filehandle for input and output! That will never work, use two different ones...

open (FILE, "<:encoding(UTF-8)", $Profile) or die $!; my @Lines = <FILE>; close(FILE); open (FILE2, ">", $Profile) or die $!;
and the end...
print FILE2 "$Line"; } close(FILE2);


Comment on Re: convert a Unicode file to Ansi, using filehandle..
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://805417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-11-27 11:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (184 votes), past polls