Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
my $dir = 'c:/windows/temp/';
my $file_name;
opendir SOMEDIR, $dir or die "Cannot open directory. $!\n";
while ($file_name = readdir SOMEDIR) {
chomp $file_name;
# Skip if file is a directory
next if (-d "$dir$file_name");
# Do some stuff to the file
}
closedir SOMEDIR;
print "Name of file (leave out extension)?\n";
$FileName=<STDIN>;
chomp $FileName;
open (INPUT, "$FileName.txt")||die;
@list=<INPUT>;
chomp @list;
close(INPUT);
foreach $line (@list){
$line=~s/^/ /;
if($line!~/[A-Za-z]/){
open(OUTFILE, ">>outfile.txt")||die;
print OUTFILE " NEW_LINE";
close(OUTFILE);
}
if($line=~/[A-Za-z]/){
open(OUTFILE, ">>outfile.txt")||die;
print OUTFILE $line;
close(OUTFILE);
}
}
open(INFILE, "outfile.txt")||die;
while(<INFILE>){
open(OUTPUT, ">>result.txt")||die;
$_=~s/^[ ]//;
$_=~s/[ ]+/ /;
$_=~s/[\t]+/ /;
$_=~s/ NEW_LINE /\n\n/g;
$_=~s/\: /:\n\n/g;
$_=~s/\. /.\n\n/g;
$_=~s/\? /?\n\n/g;
$_=~s/\; /;\n\n/g;
$_=~s/NEW_LINE/\n\n/g;
print OUTPUT "$_";
}
close(INFILE);
close(OUTPUT);
unlink("outfile.txt");
my $dir = './txt_files/'; # Path to txt files
opendir(FOLDERNAME, "$dir") or die;
my @files=grep(/\.txt$/, readdir(FOLDERNAME));
close(FOLDERNAME);
foreach my $file (@files){
open (INPUT, "$dir$file")||die;
my @list=<INPUT>;
chomp @list;
close(INPUT);
foreach my $line (@list){
$line=~s/^/ /;
if($line!~/[A-Za-z]/){
open(OUTFILE, ">>outfile.txt")||die;
print OUTFILE " NEW_LINE";
close(OUTFILE);
}
if($line=~/[A-Za-z]/){
open(OUTFILE, ">>outfile.txt")||die;
print OUTFILE $line;
close(OUTFILE);
}
}
open(INFILE, "outfile.txt")||die;
open(OUTPUT, "> ${dir}result.${file}")||die;
while(<INFILE>){
$_=~s/^[ ]//;
$_=~s/[ ]+/ /;
$_=~s/[\t]+/ /;
$_=~s/ NEW_LINE /\n\n/g;
$_=~s/\: /:\n\n/g;
$_=~s/\. /.\n\n/g;
$_=~s/\? /?\n\n/g;
$_=~s/\; /;\n\n/g;
$_=~s/NEW_LINE/\n\n/g;
print OUTPUT "$_";
}
close(INFILE);
close(OUTPUT);
unlink("outfile.txt");
}