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?? |
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.
In Section
Seekers of Perl Wisdom
|
|