in reply to Removing the space in a string
Your post is full of inconsistencies.
$s = ' input reset ; ';; $s =~ s[(?!^)(\s+)(?!$)][]g;; ## replace all spaces -- that are neith +er preceded by the start of string; nor followed by the end-of-string + -- with nothing. print "'$s'";; ' inputreset; '
but with no delimiters, there's no way to know what the actual example you have in mind contains.
But the space between 'input' & 'reset' is neither at the beginning nor the end; but you say you don't want to remove it.
Which completely contradicts your opening statement?
So, you need to explain your requirements far more clearly; with clearly delimited examples of inputs and required outputs; otherwise we're just guessing.
|
|---|