in reply to Re: Read RegEx from file
in thread Read RegEx from file

So I'd only need utf8 if I was specifying my search expressions in utf-8 rather than using the octal notation? (or, for some reason, wanted to use utf in a variable name).

Basically, I read your advice as "you can take it out - it's not needed for reading from a utf8 file" - is that right?

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm (at) cursingmaggot (stop) co (stop) uk

Replies are listed 'Best First'.
Re^3: Read RegEx from file
by 1nickt (Canon) on Jan 14, 2016 at 16:55 UTC

    That's right. You only need (and should only use) use utf8; if the source code of your script is in UTF-8, e.g. variable names, text within the script file, etc.

    For reading in a file that is UTF-8, use an IO layer. See binmode, the docs for which say:

    To mark FILEHANDLE as UTF-8, use :utf8 or :encoding(UTF-8) . :utf8 jus +t marks the data as UTF-8 without further checking, while :encoding(U +TF-8) checks the data for actually being valid UTF-8. More details ca +n be found in PerlIO::encoding.

    The way forward always starts with a minimal test.