if($variable < $threshold) { my $command = '/usr/bin/blah'; my $updatestring = << "EOF"; $variable is the value from DB. $variable is less that $threshold EOF my $UPDATE = `$command $updatestring`; } else { ... }