Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Log File Parsing using "split"

by SamCG (Hermit)
on May 19, 2006 at 18:13 UTC ( [id://550555]=note: print w/replies, xml ) Need Help??


in reply to Log File Parsing using "split"

Well, kind of minor, but:

Regarding
if ( $logfile =~ /WMS/ ) { $media = "wms"; $prefix = "/usr/home/script/${media}_cust/"; $suffix = ".$media.log"; } else { die "Unknown file format"; }
So, if it matches WMS, you set some variables, if not you die. Why, then, not just set the variables, then check the match and die? It's not (wholly) just golfing, I think it makes it a bit more logically clear.
$media='wms'; $prefix = "/usr/home/script/${media}_cust/"; $suffix = ".$media.log"; die "logfile name does not contain 'WMS'\n" if $logfile !~ /WMS/;
Also, is it now printing each full record whenever it starts with a digit? Or rather, is that what you're trying to do? I agree that you seem to be using $thiscust for multiple purposes -- once as the customer id and once as a file hande, and this seems unadvised.



-----------------
s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (9)
As of 2024-04-19 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found