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/;
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/;
\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/
^^^^