- Sometimes, using multiple regexen is easier or clearer than trying to do all the work with one (more complex) regex
- Captures the first element OP wanted; also perhaps somewhat easier to read.
#!/usr/bin/perl
use 5.016;
# 1027211
use Data::Dumper;
my @info;
my $info = '19476 2013-04-05,12:10:51.909293 host:internal.machine44.c
+ompany.net main INFO Running normally with ACTION=<processing> FAN_A=
+<OK> FAN_B=<OK> SEND=<Sent mail (221 2.0.0 Service closing transmissi
+on channel)> FAILURE=<2> ';
if ($info =~ /\d+\s(\d\d\d\d-\d\d-\d\d,\d\d:\d\d:\d\d\.\d+) / ) { # ex
+cessively detailed.
push @info, $1; # A
+well written
# ch
+ar_class would be
# an
+ improvement, as
} # wu
+d using quantifiers
while ( $info=~ /(\w+=<.*?)>/g) {
push @info, $1;
}
say Dumper @info;
output:
$VAR1 = '2013-04-05,12:10:51.909293';
$VAR2 = 'ACTION=<processing';
$VAR3 = 'FAN_A=<OK';
$VAR4 = 'FAN_B=<OK';
$VAR5 = 'SEND=<Sent mail (221 2.0.0 Service closing transmission chann
+el)';
$VAR6 = 'FAILURE=<2';
If you didn't program your executable by toggling in binary, it wasn't really programming!