I'm trying to write a program in perl that will take a binary file, convert
it to hex, then save it to a text file. So far I'm not having any luck. The
best I've been able to do is copy the file and open it in a text editor.
Here is my code:

#!/usr/bin/perl

use warnings;
use strict;

print "Enter path:\n";
my $filename = <>;
chomp $filename;
print "Save as what?\n";
my $savefile=<>;
chomp $savefile;
open (BINARY, "$filename") || die "Couldn't open file: $!";
binmode BINARY;
my $x=BINARY;
open (SAVE,">$savefile") || die "Unable to save: $!";
print SAVE 0b"$x";
close BINARY;
close SAVE;

Any ideas?

Joel

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to