Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Is a here-doc a good way to retrieve data file contents for testing?

by haukex (Archbishop)
on Jan 17, 2021 at 08:42 UTC ( [id://11127029]=note: print w/replies, xml ) Need Help??


in reply to Re: Is a here-doc a good way to retrieve data file contents for testing?
in thread Is a here-doc a good way to retrieve data file contents for testing?

sub json_here { <<'END_JSON' =~ s/\n\z//r }

Although I'd probably have done something similar, I just wanted point out that s///r requires Perl 5.14+, which may be a limitation if this is a module that is intended to be compatible with a broad range of Perl versions. sub json_here { chomp( my $json = <<'END_JSON'); $json } works fine too.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-18 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found