Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: How do I use the "File::ReadBackwards" and open in "Unicode text, UTF-32, little-endian" mode

by hashperl (Initiate)
on Mar 13, 2013 at 16:16 UTC ( #1023248=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I use the "File::ReadBackwards" and open in "Unicode text, UTF-32, little-endian" mode
in thread How do I use the "File::ReadBackwards" and open in "Unicode text, UTF-32, little-endian" mode

I have found a simple solution for my particular case, as I know that I only want to match certain strings from the log file and none of the match strings will be none ASCII characters.

I can use the ReadBackwards to read the line in then strip out none ASCII and null characters.

my $ERRORLINES_IN = File::ReadBackwards->new($logfile) or die "$logfil +e : $!\n"; while (defined($logline = $ERRORLINES_IN->readline)) { $logline =~ s/[^[:ascii:]]//g; $logline =~ s/\0//g;

It's not a perfect solution but it works for my case.

  • Comment on Re^3: How do I use the "File::ReadBackwards" and open in "Unicode text, UTF-32, little-endian" mode
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023248]
help
Chatterbox?
[1nickt]: I am sure I don't know about most of the stuff that is no longer controlled by humans. I do know that it's past the point of determining consumer pricing and into things that can kill me with blunt force!
[holli]: but is this really a problem 1nickt? Nobody knows how your human taxi drivers brain works either
[holli]: at least for cars, if the ai works better than a human on average, by all means let the machines drive

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-11-21 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (301 votes). Check out past polls.

    Notices?