http://www.perlmonks.org?node_id=655967


in reply to end of line anchor in regex

You can use the /m modifier to make $ match newlines: $text =~ s/hello$//gm;

See perlre for more information