my @new_list = grep { /regular expression/ } @list; #### ($i)= grep { m/^#/ } $_; push @new, $i;