Reputation: 305
I am trying to substitute any \n\
character with whitespace, but somehow \s
isn't recognised as a whitespace substitution character.
$match_to_array =~ s/\n/\s/;
Upvotes: 0
Views: 114
Reputation: 238186
\s
is a whole class of characters. It can mean ,
\t
, \r
, \n
, or \f
. You have to tell Perl which one to use. For example, space:
$match_to_array =~ s/\n/ /
^^^
Or tab:
$match_to_array =~ s/\n/\t/
^^^^
Upvotes: 3