Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: (dont want) split to autoremove "\n"'s

by duelafn (Parson)
on Oct 10, 2014 at 15:23 UTC ( [id://1103431]=note: print w/replies, xml ) Need Help??


in reply to (dont want) split to autoremove "\n"'s

You can use a Look-behind assertion to keep the newlines and the spaces:

$ perl -MData::Dump -wE 'my $s = qq[\n</body> \n</html>]; my @array = +split(/(?<=\n)/, $s); dd \@array' ["\n", "</body> \n", "</html>"]

Good Day,
    Dean

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1103431]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2026-04-18 01:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.