while () { push(@hold1, $1) && next if (m/(\w+\.bld):\d+:[^#]*$/); } my $hold11 = join(' ', @hold1);