Could you adjust your script to look like
use Data::Dumper;
$Data::Dumper::Useqq = 1;
my $pat = "local_alphabet_string_that_I_copy_from_the_excel_cell_into_
+the_perl_script";
print(Dumper($pat));
print(Dumper($field));
if ($field=~/$pat/){$field=...;}
and give us the output. It'll tell us which variable is wrong and how it's wrong.
| [reply] [d/l] |
| [reply] |
how do I do this? Not with use utf? This is for having utf in the code
e.g.
my $string='ΔΙΑΜΕΡΙΣΜ[
+3;';
if($field =~/$string/){ ....}
| [reply] [d/l] |
use Unicode::String;
Unicode::String->stringify_as( 'utf8' );
my $string = "This is latin text.";
my $string_utf8 = Unicode::String::latin1( $string );
print $string_utf8;
Never had to use it myself, but had this snippet from a long time ago.
| [reply] [d/l] |
As others have explained to me here previously, if you use unicode characters in your code, then you need to specify that in your uses. For example, if you are using utf8 characters within your code, you should specify "use utf8;". However, you do not need to make this declaration for characters that your code will act upon, only for those utf8 characters that are in the code itself.
For characters outside your code, you may wish to make sure that they are recognized as utf8 by perl. The following examples present some ways of doing this--though you should not need to use them all at once. These are all lines which I have used at one time or another to deal with utf8.
#FOR WORKING WITH UTF8, AS NECESSARY WITH CJK
use Encode;
#PARTICULARLY NEED THE ENCODE/DECODE FUNCTIONS
use Encode qw(encode decode);
#TO MAKE THE DEFAULT STANDARD ENCODING BE UTF8
use open qw( :std :encoding(UTF-8) );
#LIKE print CGI::header(); FOR UTF8 OUTPUT TO HTML
print "Content-type: text/html; charset=utf-8\n\n";
#SET DEFAULT I/O TO UTF8
binmode STDOUT, ":utf8";
#OPEN/READ A UTF8 FILE
open (DAT, '<:encoding(utf8)', $Data) or die "Can't open file! $!\n";
$source = <DAT>;
close DAT;
| [reply] [d/l] |