Octavian Râs,nit,a( wrote:
From: "Gunnar Hjalmarsson" <nore...@gunnar.cc>
This is an example program where "use utf8;" makes a difference:

    use utf8;
    $igår = '2009-02-24';
    print "Yesterday: $igår\n";

("igår" is Swedish for "yesterday")

Well I have tried the scripts from the 2 messages, but I must admit that I don't understand what I should look for. Both of them print the same thing, no matter if I use "use utf8;" or not....

$ cat test1.pl
$igår = '2009-02-24';
print "Yesterday: $igår\n";
$ cat test2.pl
use utf8;
$igår = '2009-02-24';
print "Yesterday: $igår\n";
$ perl test1.pl
Unrecognized character \xC3 in column 4 at test1.pl line 1.
$ perl test2.pl
Yesterday: 2009-02-24
$

The variable name, which actually is $igår, is UTF-8 encoded in the scripts. Enabling the utf8 pragma makes Perl allow that.

HTH

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to