Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: How to identify string

by pryrt (Abbot)
on Mar 11, 2020 at 16:01 UTC ( [id://11114135]=note: print w/replies, xml ) Need Help??


in reply to Re: How to identify string
in thread How to identify string

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found