> 
> Hi!
>  
> Can the perl split function split a random 40 character string into
five 8 character strings?
>  
> With random I mean that there is no special pattern in the 40
character string that can be used as split markers.
> 

This smells like homework?  (just a reminder to the gurus, it is that
time of the year again)...

perldoc -f split
perldoc -f substr
perldoc -f unpack

Just one way....


#!/usr/local/bin/perl

use strict;
use warnings;

my $long_string = "01234567" x 5;
my @strings = unpack('A8' x 5, $long_string);
print join(',', @strings) . "\n";

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to