|
Hello,
I'm looking for a neat Perl code snippet that will break a string of words of length x into n pieces of length y without violating any words. Can anyone help.
Thank you,
craigt
|
|
|
#!/usr/bin/perl
$total_text = "hey, how are you doing? I'm doing okey, that's great.";
$breakup_pattern = "[^ ]+";
my @the_snippets = map { /$breakup_pattern/gi } $total_text;
print STDOUT "Hi\n";
#I recommend running it with visual debugger (1.3 in Perl Guide)
#http://www.hermanningjaldsson.com/1/pdg/pdg.html
|
|
|
|
|
|
|
// |