in reply to Re: Scalar size limits
in thread Scalar size limits

To write a
+ in next line:

substr($_,0,49) =~ s/$/<br><font color=red>+<\/font>/ if length($_) > 50;

Now seriously: see Text::Wrap

Replies are listed 'Best First'.
Re: Re: Re: Scalar size limits
by Anonymous Monk on Jun 26, 2003 at 16:39 UTC
    Ok, I have the same question for you as I do artist. You are s/// a $, where do I set my variable to this?
    substr($_,0,49) =~ s/$/<br><font color=red>+<\/font>/ if length($_) > +50;

      $ is the end of the substr'ed $_ !

      But ignore this and see my update on Text::Wrap.

Re: Re: Re: Scalar size limits
by Anonymous Monk on Jun 26, 2003 at 16:46 UTC
    I still don't have the foggiest idea on how I would use that to do anything. How would I assign $description to that?

    Also, I checked out Text::Wrap and it's not going to work. "It formats a single paragraph at a time by breaking lines at word boundries", it sounds like this will only work if they person uses real words and spaces, my problem is someone can screw everything up by typing

    "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzz"
    and I need to find a way to break it up so it doesn't scroll the page (like it does here).

    update (broquaint): added <code> tags around the problem string

      use Text::Wrap qw( wrap $columns ); $_ = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz +zzzzzzzzzzzzzzzzzzzzzzzzzzzz"; $columns = 50; print wrap( '', '', $_ );

      output:

      zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzz
        Text::Wrap actually looks neat, I think I'll try it out on my chat script to see what it does (if it's one of those modules that you don't need to download separately).

        "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

        sulfericacid