[thelist] Perl string help

Bill Moseley moseley at hank.org
Tue Feb 13 17:24:47 CST 2007


Oh, using a module is *the* Perl way to go, of course, but what about this
method using just a regexp?

    push @lines, $1 while $text =~ s/(.{1,250})\s+//;
    push @lines, $text if $text; # orphaned text

Depending on what you want to do with newlines you might want to add
the /s switch to the regexp.

-- 
Bill Moseley
moseley at hank.org




More information about the thelist mailing list