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 } ] }-------
In reply to Re^2: Is a here-doc a good way to retrieve data file contents for testing? (updated)
by LanX
in thread Is a here-doc a good way to retrieve data file contents for testing?
by Lotus1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |