- From: Benjamin Franz <snowhare@netimages.com>
- Date: Fri, 9 Jan 1998 09:32:19 -0800 (PST)
- To: Jamie Gerdes <jgerdes@prismrsc.com>
- cc: Greg Marr <gregm@alum.wpi.edu>, www-html@w3.org
On Fri, 9 Jan 1998, Jamie Gerdes wrote: > > >perl handles < and > just fine. > > Yes, but now when you need to print out repeated lines using something like... > > STDOUT = > @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<< > $name, $email > . > > Because once you substitute the < and > with < and > it takes up 4 > spaces (4 of your @<<< spaces) instead of just one. > > So the text "<jamie>" would fit in the field "@<<<<<<", but > "<jamie>" would not. > > That's my dilemma. for($count=0;$count<$lastline;$count++) { $name=$name[$count]; $email=$email[$count]; print (&PadToLength($name,45),&PadToLength($email,10),"\n"); } print "\n"; sub PadToLength { my ($string,$maxsize)=@_; my ($padding); $string = substr($string,0,$maxsize); $padding = " " x ($maxsize - length($string)); $string=&htmlize($string) . $padding; $string; } sub htmlize { my($string)=@_; $string=~s/\&/\&/osg; $string=~s/</\</osg; $string=~s/>/\>/osg; $string=~s/"/\"/osg; $string; } Write your own formatting routine instead of depending on Perl's. Or convert *everything* to three digit numeric entities. Or use tables. Or use printf and tweek the format string on the fly. Or.... The point is that what you are complaining about is not an HTML problem but an implementation problem in your code. One that *is* solvable and does not require <PLAINTEXT>. -- Benjamin Franz
Received on Friday, 9 January 1998 12:33:51 UTC