How about this:

use Text::Wrap qw($columns);
$columns=37;
wrap $string;

-- 
Mark Thomas                    [EMAIL PROTECTED]
Sr. Internet Architect         User Technology Associates, Inc.

$_=q;KvtuyboopuifeyQQfeemyibdlfee;; y.e.s. ;y+B-x+A-w+s; ;y;y; ;;print;;
 


> -----Original Message-----
> From: Kristofer Wolff [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 10, 2001 6:29 AM
> To: perllist
> Subject: String spliiting problem
> 
> 
> hi all,
> 
> i am searching for a possibility to split a sting by words if 
> its longer
> than n Charakters.
> I know there is a regexp for splitting words, bu i don't know 
> how to use it
> in this example. Maybe you can help me ?
> If a string is longer than 37 Charakters, slpit bevor the 
> last word with
> adding an \n.
> 
> I've got:
> 
> $string = shift;
> $st_l = length($string);
> if($st_l > 37)
> {
>       [... do somthing with $string ..]
> }
> return($string);
> 
> I am thinking of splitting the strings in Words_array : if 
> this \w or \W ?
> an can i use
> @words = split(/\w/, $string); ???
> 
> and put them togeteh  while counting the charakters ??
> 
> put if there an better way ???
> 
> 
> thanxs for help kris
> 
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
> 

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to