What methods are available to translate a base64-encoded file using Perl?
I want to view and edit the file.
$ file base64result
base64result: XML document
$ls -l base64result
-rw-r--r-- 1 dpadmin appadmin 52K Oct 28 12:57 base64result
This is what I tried so far, but did not work:
#!/bin/perl
###################################################
# decode_base64.pl:
###################################################
use strict;
use MIME::Base64 qw( decode_base64 );
open INFILE, '<', $ARGV[0];
open OUTFILE, '>', $ARGV[1];
binmode OUTFILE;
my $buf;
while ( $buf = <INFILE> ) {
print OUTFILE decode_base64($buf);
}
close OUTFILE;
close INFILE;
Output:
$cat base64output
Æioz»"¢z{Äž÷¥¢—±šYìz{