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

Re: How to monitor a logfile with columns for certain data?

by thezip (Vicar)
on Nov 17, 2007 at 01:37 UTC ( #651360=note: print w/replies, xml ) Need Help??


in reply to How to monitor a logfile with columns for certain data?

Hello freddie,

There is also a solution by using unpack:

#!/usr/local/bin/perl -w use strict; use Data::Dumper; my $spec = 'A24A9A15A8A8A8'; my $line = scalar <DATA>; my @arr = unpack($spec, $line); print Dumper(\@arr); __DATA__ N-20070143.003.TXT 05/23/07 02:36:59 PM 13 13 0 __OUTPUT__ $VAR1 = [ 'N-20070143.003.TXT', '05/23/07', '02:36:59 PM', '13', '13', '0' ];

Where do you want *them* to go today?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://651360]
help
Chatterbox?
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)
[karlgoethebier]: thanks ;-
[karlgoethebier]: ...to all for reading the manuals

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-07-21 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (320 votes). Check out past polls.