Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Array of strings search

by karlgoethebier (Abbot)
on Nov 24, 2017 at 11:53 UTC ( [id://1204198]=note: print w/replies, xml ) Need Help??


in reply to Array of strings search

Cut it into pieces if you hate the regexes:

#!/usr/bin/env perl use strict; use warnings; use Data::Dump; use feature qw(say); my $string = q(Nov 19 06:37:45 proxy postgrey[2439]: action=pass, reason=triplet fo +und, client_name=uspmta194080.emarsys.net, client_address=217.175.194 +.80, sender=suite17@xpressus.emarsys.net, recipient=other.one@some.do +main); my @fields = split /action=|reason=|client_name=|client_address=|sender=|recipien +t=/, $string; my $date = ( split / proxy.+/, ( shift @fields ) )[0]; say $date; for ( 0 .. scalar @fields - 1 ) { $fields[$_] =~ s/, //; say $fields[$_]; } __END__ karls-mac-mini:monks karl$ ./split.pl Nov 19 06:37:45 pass triplet found uspmta194080.emarsys.net 217.175.194.80 suite17@xpressus.emarsys.net other.one@some.domain

I'll burn for this.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found