use Win32; use strict; my $filename_w_spaces = 'this err.txt'; # the file has to exist to play this game.... if ( -e $filename_w_spaces ) { print "$filename_w_spaces\n"; my $short_filename_wo_spaces = Win32::GetShortPathName($filename_w_spaces); print "$short_filename_wo_spaces\n"; my $long_filename_w_spaces = Win32::GetLongPathName($short_filename_wo_spaces); print "$long_filename_w_spaces\n"; }