#!/usr/bin/perl use strict; use warnings; open("test", "; my @ex = grep(!/^####/, @array); my @test2 = grep(/#bg\sas,([a-z0-9])#end/, @ex); print @test2; close("test"); __DATA__ ####---------------------k ####---------------------l ####---------------k #bg at,super spaz razz tazz kazz #end #bg as,clock brock spock mock sock #end #bf as,lost fluff muff tuff cuff #end #bf aa,sauce dock spork fork torque #end ####-------------d-d ####------g-d