perlron has asked for the wisdom of the Perl Monks concerning the following question:
update I still have one issue the comma character appears as €TM. I suspect its a encoding issue of my text file. I am using textedit on a mac which doesnt seem to have a save as UTF8 option.strange. Im just updating this query than create a new one. Im going to try some options but please tell me which is the best way out, as this problem seems a generic one. use utf8 encoding in my perl script. recreate the text file in vim any other options ?#!/usr/bin/perl use strict; my ($key,$name,%countries); open (my $fh1,"<","files/country_listv1.txt") or die $!; while(<$fh1>){ if (!exists $countries{$_}){ $countries{$_} = '1'; } } open (my $fh2,">","files/country_listv2.txt") or die $!; foreach $key (sort keys %countries){ print $fh2 $key; } close($fh1,$fh2);
|
|---|