#! /usr/bin/perl use warnings; use strict; use String::Interpolate; my $template = 'String::Interpolate'->new; $template->('http://something.com/api_stuff/$GUID'); make_call( '1234' ); sub make_call { my $GUID = shift; $template->{GUID} = $GUID; POST("$template"); } use Test::More; sub POST { is shift, 'http://something.com/api_stuff/1234', 'intepolates'; } done_testing(); #### #! /usr/bin/perl use warnings; use strict; use Template; my $template = 'http://something.com/api_stuff/[%GUID%]'; make_call( '1234' ); sub make_call { my $GUID = shift; my $template_object = 'Template'->new; $template_object->process(\$template, {GUID => $GUID}, \ my $output); POST($output); } use Test::More; sub POST { is shift, 'http://something.com/api_stuff/1234', 'intepolates'; } done_testing();