I can't log the variable because as I explain is not happened every time.

The two aren't related. You can easily log something that doesn't happen every time:

use warnings; use strict; use Data::Dumper; $Data::Dumper::Useqq=1; my $count = 0; for (1..100) { my $string = ("0\x04\x88\x80\x80\x80\x86\x98\x050", "7630001998")[ + (rand()<0.1) ? 0 : 1 ]; if($string =~ /[^0-9]/) { print STDERR "Warning, weird string #", ++$count, " on run #$_ + at ", scalar localtime, ": ", Dumper($string); } } __END__ Warning, weird string #1 on run #7 at Wed Mar 11 08:59:53 2020: $VAR1 += "0\4\210\200\200\200\206\230\0050"; Warning, weird string #2 on run #16 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #3 on run #30 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #4 on run #36 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #5 on run #37 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #6 on run #46 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #7 on run #54 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #8 on run #60 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #9 on run #71 at Wed Mar 11 08:59:53 2020: $VAR1 + = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #10 on run #95 at Wed Mar 11 08:59:53 2020: $VAR +1 = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #11 on run #96 at Wed Mar 11 08:59:53 2020: $VAR +1 = "0\4\210\200\200\200\206\230\0050"; Warning, weird string #12 on run #98 at Wed Mar 11 08:59:53 2020: $VAR +1 = "0\4\210\200\200\200\206\230\0050";

Notice the "weird" event happens only ~10% of the time, but it can datalog just fine. Use whatever logging system you have in place, rather than STDERR, in your application.


In reply to Re^2: How to identify string by pryrt
in thread How to identify string by Acnapyx

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.