Your data lines are different enough that each type needs its own parser. A hash of coderefs ("dispatch table") will do that nicely,
my $parser = {
OFF => sub {()},
SUCCESS => sub {
local $_ = shift;
/\((\w*)\)/
}, # call these in list context!
ERROR1 => sub {
local $_ = shift;
/disk number \((\d+)\) at \((\d+:\d+)\)/;
},
WARNING1 => sub {
local $_ = shift;
/(\w.*)^/;
}
};
sub parse_line {
local $_ = shift;
my ($key, $data) = split ':', $_, 2;
$key =~ tr/()//d;
($key, $parser->{$key}->($data));
}
parse_line() should be called in list context, too.