@lines = grep(/(.+)\:(.+)/, @lines); # for the whole line from an array #for the parts out of lines from a file. while(<$fh>){ if(/(.+)\:(.+)/){ $before = $1; $after = $2; } }