my @list = split /^\s*(?:\n|\z)/m; shift @list if @list && $list[0] eq ""; # remove empty first element