$line =~ s/Hi\s*?$//m; [download]
In reply to Re: \s matches newline in regex? by kroach in thread \s matches newline in regex? by Only1KW