patgas has asked for the wisdom of the Perl Monks concerning the following question:
This is the first thing I've written apart from little tutorial excercises, and it was suggested that I post this to SoPW for further advice, so here goes...
All this does is take an HTML file (or any file, really), wrap an ASP Response.Write command around each line, and dump it back out to a file. Nothing fancy, but I'd like to know if there's something I could be doing better.
($infile, $outfile, $indent) = @ARGV; open(IN, $infile) or die "Can't open input file: $!"; open(OUT, ">" . $outfile) or die "Can't open output file: $!"; print "Starting..."; print OUT "<%\n"; while(<IN>) { chomp; print OUT (" " x $indent) . "Response.Write("; if ($_) { print OUT "\"$_\" + "; } print OUT "vbNewLine)\n"; } print OUT "%>\n"; print "Done."; close IN or die "Can't close input file: $!"; close OUT or die "Can't close output file: $!";
And thanks to the chatterbox folks for helping me with the most egregious errors!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A simple input/output script, suggestions wanted
by premchai21 (Curate) on Apr 11, 2001 at 22:16 UTC | |
|
Re: A simple input/output script, suggestions wanted
by suaveant (Parson) on Apr 11, 2001 at 22:24 UTC | |
|
Re (tilly) 1: A simple input/output script, suggestions wanted
by tilly (Archbishop) on Apr 12, 2001 at 06:59 UTC |