Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Some assistance with splitting variables

by hdb (Prior)
on Apr 05, 2013 at 20:28 UTC ( #1027216=note: print w/ replies, xml ) Need Help??


in reply to Some assistance with splitting variables

Or like this:

use strict; use warnings; my $line="19476 2013-04-05,12:10:51.909293 host:internal.machine44.com +pany.net main INFO Running normally with ACTION=<processing> FAN_A=<O +K> FAN_B=<OK> SEND=<Sent mail (221 2.0.0 Service closing transmission + channel)> FAILURE=<2>"; $line =~ s/\d+ (.*?) /DATE=<$1> /; # to give you the date as well ;) my %info = $line =~ /(\w+)=<(.*?)>/g; print "$_:$info{$_}\n" for keys %info;

UPDATE: Added the date field...


Comment on Re: Some assistance with splitting variables
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2015-07-06 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls