On 2011-07-28 15:23, Khabza Mkhize wrote:
I want to substring words, I might be using wrong terminology. But I tried
the following example the only problem I have it cut word any where it
likes. eg "breathtaking" on my string is only bre.
$string = "This is an awe-inspiring tour to the towering headland
known as Cape Point. Magnificent beaches, breathtaking views, historic and
picturesque coastal ";
$rtioverview = substr ( $string , 0 , 100 );
Reults = "This is an awe-inspiring tour to the towering headland known
as Cape Point. Magnificent beaches, bre";
any one can help to solve this problem please?
perl -wle '
my $string = "This is an awe-inspiring tour to the towering"
. " headland known as Cape Point. Magnificent"
. " beaches, breathtaking views, historic and"
. " picturesque coastal ";
my ($rtioverview) = $string =~ /(.{0,100})\b/;
print $rtioverview;
'
prints:
This is an awe-inspiring tour to the towering headland known as Cape
Point. Magnificent beaches,
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/