Well, this is what I'm working on that caused me to write my previous questions. Someone wrote me a oneliner (the stuff with elsif) on a napkin two years ago, but before today I never ran a Perl program. I have been doing math programs in Fortran/Algol/C for thirty years but whenever text is involved, I usually run and hide.
Basically it takes a speech written in normal DOS text and makes it so you can read it at a podium and not look contrived. It should reformat it from 77 cols to 37 cols, then double space and put hyphens on every other line and equal signs on every fourth line. $columns = 37; use Text::Wrap; $Text::Wrap::columns= $columns; open(file from command line) open(tempfile1) open(tempfile2) while (<file>) { $_=wrap(q(),q(),$_); print file; } continue { close ARGV if eof } open(file from command line) while (<file>) { if ($.%4==2) {$_ .= qq(\n).(q(-) x $columns).qq(\n)} elsif ($.%4==0) {$_ .= qq(\n).(q(=) x $columns).qq(\n)} else {$_ .= qq(\n)}; print file; } continue { close ARGV if eof } delete (tempfile1) delete (tempfile2) (this is a wrap routine I found on the net) (in case GNU DOS 4.0M4 Okahata Perl doesn't have Text::Wrap) $linelength = 72; $indent = " "; while (<>) { @words = split " ", $_; $loc = length($indent); printf "$indent"; foreach $word (@words){ if ((length($word) + 1 + $loc) > $linelength) { printf "\n$indent"; $loc = length($indent);; } printf "$word "; $loc += length($word) + 1; } printf "\n"; } -- - = - Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist http://ourworld.compuserve.com/homepages/vjp2/vasos.htm ---{Nothing herein constitutes advice. Everything fully disclaimed.}--- [Homeland Security means private firearms not lazy obstructive guards] [Urb sprawl confounds terror] [Remorse begets zeal] [Windows is for Bimbos] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/