i used this
while(my $file=glob("$dir/*")){
but as the directory has whitespace in path-name it cause error ,how i can solve this?

Note that glob will split its arguments on whitespace, treating each segment as separate pattern.

from http://perldoc.perl.org/functions/glob.html
Instead you can use the File::Glob module to override the behaviour of Perl's built-in glob function.

use 5.006;
use strict;
use warnings;

use File::Glob ':glob';
my @files = </home/david/Programming/untitled folder/*>;
foreach (@files) {
	print "$_ \n";