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?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
WOW, this even allows interpolating variables from the function scope in the "outside" HERE-DOC ...
use strict; use warnings; print "-------\n"; print json_here(42,666); print "-------\n"; sub chompit { my $str = shift; chomp $str; return $str; } sub json_here { my $x=shift; chompit << "__JSON__" } "Type": 0, "Width": 504, "X": $x, "Y": $_[0] } ] } __JSON__
C:/Perl_524/bin\perl.exe -w d:/tmp/pm/chomp_here.pl ------- "Type": 0, "Width": 504, "X": 42, "Y": 666 } ] }-------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is a here-doc a good way to retrieve data file contents for testing? (updated)
by tybalt89 (Monsignor) on Jan 17, 2021 at 02:56 UTC | |
by LanX (Saint) on Jan 17, 2021 at 03:24 UTC | |
by Corion (Patriarch) on Jan 17, 2021 at 07:06 UTC | |
by haukex (Archbishop) on Jan 17, 2021 at 08:51 UTC | |
by haj (Vicar) on Jan 17, 2021 at 09:33 UTC |