i have text file that contain emoji unicode caracter for exemple
If you look at perldoc perlre for \N
, you see that it means "named Unicode character or character sequence".
You can use this instead:
if ($ligne =~ m/\N{U+1F60D}/)
# or
if ($ligne =~ m/\x{1F60D}/)
Edit: It's also described in the link you posted, https://perldoc.perl.org/perluniintro.html
Edit: The content you read is probably not decoded. You want:
use Encode;
...
my $ligne = decode_utf8 $_;
or simply open the file directly in utf8 mode:
open my $fh, "<:encoding(UTF-8)", $filename or die "Could not open $filename: $!";
while (my $ligne = <$fh>) {
if ($ligne =~ m/\N{U+1F60D}/) { ... }
}
You never showed how you open the filehandle called FIC
, so I assumed it was utf8 decoded.
Here is another good tutorial about unicode in perl: https://perlgeek.de/en/article/encodings-and-unicode