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 ",".
open(FH,'<file') or die "$! can't open";
open (FH1,'>file1') or die "$! can't open";
print FH1 $var;
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.