2

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.
Charles
  • 50,943
  • 13
  • 104
  • 142
sid_com
  • 24,137
  • 26
  • 96
  • 187

1 Answers1

0

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

Community
  • 1
  • 1
MUY Belgium
  • 2,330
  • 4
  • 30
  • 46