Copy file by reading one file and save to another file : binmode « File « Perl






Copy file by reading one file and save to another file

    

open INFILEHANDLE, "<data.uue";
open OUTFILEHANDLE, ">data.dat";

binmode OUTFILEHANDLE;    #Necessary in MS DOS!

while (defined($line = <INFILEHANDLE>)) {
    print OUTFILEHANDLE unpack('u*', $line);
}

close INFILEHANDLE;
close OUTFILEHANDLE;

   
    
    
    
  








Related examples in the same category

1.Change file handle to binary mode
2.binmode command sets up a file for access in binary mode with no mapping of carriage returns.
3.Win32 Binary Files
4.Unbuffered perl io