use strict; sub file_name { no strict 'vars'; no strict 'refs'; my @arg = qw(client_number MM DD S); for (@arg) { $$_ = defined($_[0]) ? shift : die "$_ not defined" } "I$client_number$MM$DD$S" } my $out = file_name 1,2,3,4; warn $out; #### { local $" "I@_" }