[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lame questions about perl and character recoding



On Fri, 18 Jan 2002, Ingvarr Zhmakin wrote:

> From: Ingvarr Zhmakin <ingvarr@mail.ru>
> Subject: Re: lame questions about perl and character recoding
>
> Еще одно.
>
> Как строчку разбить на части заданного размера?
> Пользую
>   split (/(.{0,$limit_size})/s, <...what-t-split...>)
> Но ведь должен быть более прямой способ?!

my @a = (); my $l = length($string);
for ($i=0;$i<$l;$i+=$limit_size) {
  push @a,substr($string,$i,$limit_size);
}

-- 
Victor Wagner			vitus@ice.ru
Chief Technical Officer		Office:7-(095)-748-53-88
Communiware.Net 		Home: 7-(095)-135-46-61
http://www.communiware.net      http://www.ice.ru/~vitus



Reply to: