Dear Friend,

You can use the following coding. But it is working for only file. because I have used only one file.

The file contents are available in the following file /jumbo/in/file.
The following program also available in the same directory.

Then I have created another file in the directory /jumbo/in/. That file is used to write the content after the replace the space as ",".

Code:
 
use strict;
use warnings;
open(FH,'<file') or die "$! can't open";
open (FH1,'>file1') or die "$! can't open";
my $var;
while($var=<FH>)
{
    $var=~s/ /,/g;
    print FH1 $var;
}
system('mv file1/jumbo/out/');

But the above code only work for only one file. If you want to perform the operation multiple files or single file. But your code will show me as multiple files.