if ( my ( $raw_dt, $refs ) = /^(.*) UTC.*refs = (\d+)$/ ) { my $dt = $Strp->parse_datetime($raw_dt); ... } else { # possible error condition }