How to get a defined ${^OPEN}?

57 Views Asked by At

What changes are required in this code to get a defined ${^OPEN}?

#!/usr/bin/env perl
use warnings;
use strict;
use open qw( :std :utf8 );

print ${^OPEN};

Use of uninitialized value $^OPEN in print at ./perl.pl line 6.
1

There are 1 best solutions below

0
MUY Belgium On

This is quite uneasy way. May be it is better to user more readable Perl.

:utf8 outputs utf-8 charset but does not checks its validity, you should not use this one, except for one liners. Use :encoding(UTF-8) instead.

Please refer to this post How differs the open pragma with different utf8? for more information about different types of utf-8 input/outputs.

I even do not know what could possibly be ${^OPEN} variable. I advice you not to use it at all, as you should not use magic punctuation.

Hope it helps