> However, when I try to seacch for it using
if ($line=~/[\xfb|\xfc]/) {
Advertising
Note, you're mixing the character class " [ab] " with grouping alternative
pipe " ( a | b ) " here
> or even just
if ($line=~/\xfb/) {
Dunno, works here:
$ perl -e '$line = "hi" . chr 251 . "ho" . chr 252 ; if
($line=~/[\xfb\xfc]/) { print "yep" } print "\n"'
yep
$ perl -e '$line = "hi" . chr 250 . "ho" . chr 253 ; if
($line=~/[\xfb\xfc]/) { print "yep" } print "\n"'
[crickets]
So, I'd guess your $line doesn't have a \xfb or \xfc in it at the time of
the test.
$ perl -e '$line = "hi" . chr 251 . "ho" . chr 253 ; if
($line=~/([\xfb\xfc])/) { print "yep: $1" } print "\n"' | od -c
0000000 y e p : 373 \n
0000007
On Thu, Apr 12, 2018 at 11:26 AM, Gary Stainburn <
gary.stainb...@ringways.co.uk> wrote:
> I have a text file (created by pdftotext) that I've imported into my
> script.
>
> It contains ASCII characters 251 for crosses and 252 for ticks. If I load
> the
> file in gvim and do :as
>
> it reports the characters as
>
> <u> 251, Hex 00fb, Octal 373
> <u> 252, hex 00fc, Octal 374
>
> However, when I try to seacch for it using
>
> if ($line=~/[\xfb|\xfc]/) {
>
> or even just
>
> if ($line=~/\xfb/) {
>
> it always fails. What am I doing wrong?
>
> Gary
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>
--
a
Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk