in reply to Indent Perl

This is what I use after cut'n'pasting code, to tidy it up. It will leave a *.ERR file if there are syntax errors.
#!/usr/bin/perl -w use strict; my $infile = shift; my $outfile = "$infile.tmp"; open my $infh, '<', $infile or die "Cannot open $infile: $!\n"; open my $outfh, '>>', $outfile or die "Cannot open $outfile: $!\n"; while (<$infh>) { s/^\s+//g; s/\s+$//g; print $outfh $_, "\n" or die "Cannot write to $outfile: $!\n"; } close $outfh or die "Cannot close $outfile: $!\n"; close $infh or die "Cannot close $infile: $!\n"; system('perltidy', $outfile) == 0 or die "Perltidy failed\n"; rename "$outfile.tdy", $infile or die "Cannot rename $outfile.tdy: $!\ +n"; unlink $outfile or die "Cannot unlink $outfile: $!\n"; chmod 0755, $infile or die "Cannot chmod $infile: $!\n";

I'm not really a human, but I play one on earth. flash japh