Dear Monks,

Below some code, where i've (out of habit) used a couple of UN*X utilities to ease the job; Now i may have to deploy this code on MSWin PCs (without these utils, -- and i don't want to bundle freeware versions of the utils with the code).

So i've written some Perl alternatives for the "inlined" ls, sed and cat calls, but these are certainly not the only - and probably not the best - way to skin these cats. Any suggestions for improvement ?

#___________________________________________________________ #1A: Read files sorted ascending on timestamp @files = `ls -t -1 -r $dir`; # strip ./../ & process .msg/.txt #1B: Same using plain vanilla Perl ... foreach my $g qw(msg txt) { push @files, glob("$dir\\*.$g"); } my %files = map { $_, -M} @files; @files = reverse (sort { $files{$a} <=> $files{$b} } keys %files); #___________________________________________________________ #2A: Strip $author} line system "sed s/{author}.*//g <$file >${file}1..txt"; ($TRACE>=2) and system "cat ${file}1.txt"; #2B: Same using plain vanilla Perl ... open (FH, "<${file}.txt") or die "Can't open ${file}.txt: $!\n"; open (FH1, ">${file}1.txt") or die "Can't create ${file}1.txt: $!\n"; while (<FH>) { next if (/{author}/); print FH1; ($TRACE>=2) and print; } close (FH) or die "Can't close ${file}.txt: $!\n"; close (FH1) or die "Can't close ${file}1.txt: $!\n"; #___________________________________________________________ #3A: ($TRACE>=2) and system "cat VSort.txt"; #3B: Same using plain vanilla Perl ... if ($TRACE>=2) { open (FH, "<$file") or die "Can't open $file: $!\n"; while (<FH>) { print; } close(FH) or die "Can't close $file: $!\n"; }

Best regards,
Allan Dystrup

As the eternal tranquility of Truth reveals itself to us, this very place is the Land of Lotuses
-- Hakuin Ekaku Zenji