# this initializes the field correctly $row->[15] = ''; # This overwrites the empty field with undefined if it doesn't match. ($row->[15]) = $row->[5] =~ /(#[^ ]+)/;