in reply to regex pattern match
Why not just split the data and put all of it into a hash?
use strict; use warnings; my $data = do {local $/; <DATA>}; my %hash = map {split /:\s*/, $_, 2} map {split "\n"} $data; print "Task Name = ", $hash{TaskName}, "\n"; print "Status = ", $hash{Status}, "\n"; print "Last Result = ", $hash{"Last Result"}, "\n"; __DATA__ HostName: LAP3220889 TaskName: infiniteloop Next Run Time: Never Status: Last Run Time: 21:45:18, 22/06/2011 Last Result: 0
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: regex pattern match
by MarcAllan (Novice) on Jun 24, 2011 at 07:39 UTC | |
by Marshall (Canon) on Jun 24, 2011 at 18:55 UTC | |
by MarcAllan (Novice) on Jun 25, 2011 at 10:56 UTC | |
by MarcAllan (Novice) on Jun 27, 2011 at 08:50 UTC |
In Section
Seekers of Perl Wisdom