i have a code belows;
my $max_word = 22;
my $advertbody = join (" ", (split (/\s/, $advertbody))[0..$max_word-1]);
print "advertbody limited--> ", $advertbody, "\n";
The code accept up to 22 words.
If there are for example, 10 words comes it prints the rest of 12 words as empty spaces.
It looks like this; abc aksd a |as|1233|as| and so on.
This space is wrong, how can i change in code?