$ perl -e ' use strict; use warnings; use autodie; my %info = qw{X 3 Y -4 Z 5}; handle_csv_file(@info{qw{X Y Z}}); sub handle_csv_file { my ($X, $Y, $Z) = @_; my $csv_file = sprintf q{D:\PROJ\%s\%s\%s.csv}, $X, $Y, $Z; open my $fh, "<", $csv_file; # do something with $fh here return; } ' Can't open 'D:\PROJ\3\-4\5.csv' for reading: 'No such file or directory' at -e line 14