Hi, welcome to the monastery!

I took a look at your post and I have some thoughts about both the post and the code.

First, regarding your post. The following things about it make it difficult to help you:

For tips on how to get better help, please see:

With regard to your code, while there are lots of things about it that could be improved, both it and the following Short, Self-Contained, Correct Example "work" and produce the same essential output.

use strict; use warnings; use Encode::Guess; my $encodings_test = 'ascii cp1252 cp437 cp850 iso-8859-1 utf-8-strict + utf8'; guess_encoding('some text', qw/$encodings_test/);
Output:
Unknown encoding: $encodings_test at /Users/1nickt/perl5/perlbrew/perl +s/perl-5.30.1/lib/5.30.1/darwin-2level/Encode/Guess.pm line 120.

An even simpler SSCCE :

use strict; use warnings; use Test::More tests => 2; my $str = 'foo bar baz'; my @arr = ('foo', 'bar', 'baz'); is_deeply( [ qw/foo bar baz/ ], [ @arr ] ); is_deeply( [ qw/$str/ ], [ @arr ] );
Output:
11115052-3.pl .. 1..2 ok 1 not ok 2 # Failed test at 11115052-3.pl line 8. # Structures begin differing at: # $got->[0] = '$str' # $expected->[0] = 'foo' # Looks like you failed 1 test of 2. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests Test Summary Report ------------------- 11115052-3.pl (Wstat: 256 Tests: 2 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.05 cusr + 0.00 csys = 0.07 CPU) Result: FAIL
See qw.

A couple of other observations I had:

Hope this helps!


The way forward always starts with a minimal test.

In reply to Re: issue with Encode::Guess by 1nickt
in thread issue with Encode::Guess by toohoo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.