Sure, you can do it like this, no need for eval here.
What happened when you tried?
#!/usr/bin/perl -w
use strict;
package Fyp::Security;
sub log {
my $arg = shift;
print $arg;
};
package main;
my $experiment_name = 'foo';
my $dirname = "/experiments/$experiment_name";
Fyp::Security::log( "Creating dir $dirname\n" );
Interpolation - just like concatenation, i.e. "Creating dir " . $dirname . "\n" - happens at runtime, so you can arbitrarily "chain" interpolations (if that's what your question is...)
|