in reply to how to prevent new line added in HERE document
Take this code:
When you run this you'll see there is no extra newline - so calling a sub does not magically add one.#!/usr/bin/perl -w use strict; use warnings; my $code=<<"END_MSG"; line 1 line2 END_MSG sub foo{ return $code; } print "before calling\n"; print $code; print "after calling\n"; print foo();
But what you do is to embed the $code argument in yet another here-document which is where your extra-newline comes from.
|
|---|