my $a; foreach (@arrayofvariables){ $a .= $_; } my $proc_run = "BEGIN run_proc(:1) END\;" # then bind it with $a