while (chomp(my $temp=)){ print Dumper $temp; if ($temp =~ /#/){ $temp =~ s/#$'//; } if ($temp =~ /^\s*$/){ next; } print "after regex:\n"; print Dumper $temp; print "end\n"; }