#!/usr/bin/perl -w use strict; use warnings; sub foo{ my $code = shift; <<"END_MSG"; Add the code $code END_MSG } my $code=<<'END_MSG'; line 1 line2 END_MSG print "before calling\n"; print $code; print "after calling\n"; print foo($code); print "why blank line above?\n";