Adding a linebreak to the end of a string.

Hey!

I'm writing a simple guestbook with perl, but now I'm stuck.

When I present the comments on the output page, the table becomes stretched and ugly. I need a way to add a '
' when/if the string exceeds, let's say, 40 characters.

Does anybody know how I could fix the problem?

Thanks.

Comments

  • : Hey!
    :
    : I'm writing a simple guestbook with perl, but now I'm stuck.
    :
    : When I present the comments on the output page, the table becomes stretched and ugly. I need a way to add a '
    ' when/if the string exceeds, let's say, 40 characters.
    :
    : Does anybody know how I could fix the problem?
    :
    : Thanks.
    :

    [code]wrap="hard"[/code]
    Add that within the html textarea.
  • : : Hey!
    : :
    : : I'm writing a simple guestbook with perl, but now I'm stuck.
    : :
    : : When I present the comments on the output page, the table becomes stretched and ugly. I need a way to add a '
    ' when/if the string exceeds, let's say, 40 characters.
    : :
    : : Does anybody know how I could fix the problem?
    : :
    : : Thanks.
    : :
    :
    : [code]wrap="hard"[/code]
    : Add that within the html textarea.
    :

    It doesn't seem to work when I use it in a ... Or did you mean that I should put it somewhere else?
  • : : Hey!
    : :
    : : I'm writing a simple guestbook with perl, but now I'm stuck.
    : :
    : : When I present the comments on the output page, the table becomes stretched and ugly. I need a way to add a '
    ' when/if the string exceeds, let's say, 40 characters.
    : :
    : : Does anybody know how I could fix the problem?
    : :
    : : Thanks.
    : :
    :
    : [code]wrap="hard"[/code]
    : Add that within the html textarea.
    :

    Sorry, I misunderstood your reply. It's fixed now, thank you!
  • Hi,

    The HTML solution is a nice easy way to sort it out in your case so I say go with that, but another option is to use Text::Wrap. See here:-

    http://search.cpan.org/author/JHI/perl-5.8.0/lib/Text/Wrap.pm

    Just a thought... :-)

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories