G
Guy Smiley
Hello,
After googling and perldoc'ing, I'm still struggling to figure out the best
way to remove the last word from a string (without any line-ends or carriage
returns).
$output = "data1 data2 data3 data4";
Would like to see:
data1 data2 data3
I need to get this done soon and I have a long way to go before I understand
how to do this with a regex.
I'm also thinking that I could split the string at the spaces and construct
a new string by iterating through the array count minus 1. But this seems
like overkill.
my @datas = split(' ', $output);
for-loop
etc;
Any insight is greatly appreciated.
After googling and perldoc'ing, I'm still struggling to figure out the best
way to remove the last word from a string (without any line-ends or carriage
returns).
$output = "data1 data2 data3 data4";
Would like to see:
data1 data2 data3
I need to get this done soon and I have a long way to go before I understand
how to do this with a regex.
I'm also thinking that I could split the string at the spaces and construct
a new string by iterating through the array count minus 1. But this seems
like overkill.
my @datas = split(' ', $output);
for-loop
etc;
Any insight is greatly appreciated.