in reply to parse array to replace specific spaces with pipes
Replace $_ =~ s/\s/\|/g; with local $"='|';.
$" sets the delimiter between array elements in a double quoted string. By default, it is set to a single space which is why you were originally seeing a space between array elements. The space wasn't part of the array elements, nor the array, which is why trying to substitute spaces with pipes didn't work.
$" is a global variable. The keyword local keeps your custom setting of that variable from affecting other parts of your code. Your custom setting will only apply within the while loop.
Best, beth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: parse array to replace specific spaces with pipes
by neurotoxx (Novice) on Jul 10, 2009 at 16:40 UTC |