I have a script to list the file names in a directory .When i run this script locally (command prompt) it displays the exact file name (even though the file name has two spaces).But i upload the script into server (Browser) it shows trimmed file names(single space for double spaces).
I have checked both IE and Firefox it shows only single space file name instead on double space file name. Is it browser problem.
Expand|Select|Wrap|Line Numbers
- #!/usr/bin/perl
- my @distinct_download_path=('c:/perl/examples/array');
- for(@distinct_download_path){
- next if /^(\s)*$/;
- unless (opendir(DIR,$_)){ push(@download_invalid_directory,$_);}
- while($file=readdir(DIR)){
- next if/^(\s)*$/;
- next if(($file eq ".")||($file eq ".."));
- next if(-d $file); #next if $file is directory
- $_=~s/(.)\/$/$1/; #remove last /
- $file=$_.'/'.$file; #construct full path
- push(@list_files_in_download_directory,$file);
- }
- }
- print "content-type:text/html\n\n";
- print join("\n",@list_files_in_download_directory);
-------------------------------------
c:/perl/examples/array/data structure.pl
c:/perl/examples/array/dumper.pl
c:/perl/examples/array/rajiv gandhi.pl# here the file name actually has two spaces between rajiv and gandhi but it shows only one space.
Script Output For server run
-------------------------------------
c:/perl/examples/array/data structure.pl
c:/perl/examples/array/dumper.pl
c:/perl/examples/array/rajiv gandhi.pl
Please help me.
Regards
Rajiv