in reply to Splitting a string into words
This will extract anything up to 12 characters (greedy) that is followed by whitespace. It does what you described, but needs work to be of more general use.
#! /usr/bin/perl use strict; use warnings; my $string = 'this is a test message'; my ($chunk) = $string =~ /(.{1,12})\s/; print $chunk, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Splitting a string into words
by ikegami (Patriarch) on Aug 11, 2005 at 17:12 UTC | |
|
Re^2: Splitting a string into words
by tphyahoo (Vicar) on Aug 12, 2005 at 08:31 UTC |