codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  string break up  craigt at 15:13 on Saturday, May 05, 2007
 

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

  Re: string break up  mimir at 21:27 on Monday, May 28, 2007
 

#!/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









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Validaing User Id using JSP and Servlet
•  IMPLEMENT JAVABEANS IN JSP
•  Re: Can anyone please help me, html table to access.
•  disabling submit after clicking once
•  Win32::Perms and ACL order
•  Re: crystal report - Logon failed.
•  Memory allocation
•  Need Code
•  Re: store string from text file to vector


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007