You can also use a positive lookahead in the regex to avoid replacing the newline char.
$line =~ s/Hi\s*(?=\n)//;
In reply to Re: \s matches newline in regex?
by stevieb
in thread \s matches newline in regex?
by Only1KW
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |