# replace $myline with your variable or $_ if($myline !~ /\.$/){ $myline .= ".\n"; }