develooper Front page | perl.beginners | Postings from October 2009

Re: split n characters into n chunks

Thread Previous | Thread Next
From:
Shlomi Fish
Date:
October 25, 2009 06:50
Subject:
Re: split n characters into n chunks
Message ID:
200910251548.55743.shlomif@iglu.org.il
On Sunday 25 Oct 2009 14:39:32 Shawn H Corey wrote:
> Michael Alipio wrote:
> > Any idea how to do this? I'm thinking maybe I can just
> > split the whole string and push each character into array,
> > then loop through the array, getting 3 elements set in the
> > proces..
> 
> Split the string into an array, loop through it and use a slice to join
> the elements.
> 

Why not use perldoc -f substr ( http://perldoc.perl.org/functions/substr.html 
) in a loop? Alternatively one can use unpack but I'm not sure how well it 
would handle Unicode characters.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
First stop for Perl beginners - http://perl-begin.org/

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About