When I say simple, I mean, within an expression, so that I can stick it in as a value in a hash without preparing it first. I'll post my solution but I'm looking for a better one that reminds me less of VB. 🙂
Perl – What’s the simplest way to return the first line of a multi-line string in Perl
multilineperlstring
Related Question
- Python – Convert bytes to a string
- Java – Does Java have support for multiline strings
- Bash – Extract filename and extension in Bash
- Javascript – How to make the first letter of a string uppercase in JavaScript
- Java – Simple way to repeat a string
- Javascript – the correct way to check for string equality in JavaScript
- Ukkonen’s suffix tree algorithm in plain English
- Pythonic way to create a long multi-line string
Best Solution
How about
?
You don't have to worry about \n being not cross-platform because Perl is clever enough to take care of that.