if (ref $data->{foo} eq "ARRAY") { # list } else { # single message } #### unless (ref $data->{foo} eq "ARRAY") { $data->{foo} = [ $data->{foo} ]; }