in reply to Re^2: Perl regex txt file new line (not recognised?)
in thread Perl regex txt file new line (not recognised?)
use strict; use warnings; my $file = \do{my $disk_file = "Inventorier\n" ."Trade receivables\n" ."Assets\n" ."This item includes impairment losses.\n" ; }; open (IN,'<:encoding(UTF-8)', $file) or die "Could not open '$file'$!" +; *OUT = *stdout; while (my $text = <IN>) { #$text =~ s/^[a-z].*[a-z]$//gmi; $text =~ s/^[a-z].*[a-z]\n$//i; print OUT $text; } close (IN) or die "Could not close input file: '$file' $!";
Note that I have not made any other changes to your posted code (except to remove the looping and the output files.) Even though this should 'work', I prefer LanX's first suggestion.
|
|---|