in reply to Re^5: Any good ways to handle NARROW NO-BREAK SPACE characters in regex in newer versions of Perl?
in thread Any good ways to handle NARROW NO-BREAK SPACE characters in regex in newer versions of Perl?
Ok, before you give up on me. I put the file named Screenshot-2024-02-23-at-1.05.14 AM.png in directory (with the hidden space charachter) along with this script in the same dir:
#! /usr/bin/env perl use v5.36; use utf8; # get all the files in the current directory my @files = glob("*"); my ($file) = grep { /Screenshot-2024-02-23-at-1.05.14\s/ } @files; say $file;
The above reports: Use of uninitialized value $file in say at ./test.pl line 10.
If I change the regex to /Screenshot-2024-02-23-at-1.05.14/ it works fine.
I'm beginning to think Perl does not handle these chars in file names properly. But I'm clueless so that's a wild guess.
EDIT: I should definitely mention I'm on macos which I heard doesn't have the best support for utf8</c>
EDIT2: I tried this script on a linux docker container. Same result as on macOS
$PM = "Perl Monk's";
$MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
$nysus = $PM . ' ' . $MC;
Click here if you love Perl Monks
|
---|