Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: binmode binmoding binmode again

by DamnDirtyApe (Curate)
on Apr 28, 2004 at 21:35 UTC ( #348967=note: print w/replies, xml ) Need Help??

in reply to binmode binmoding binmode again
in thread Problem Encoding/Decoding PDF with MIME::Base64

Thanks PodMaster, that was it precisely. I rewrote the programs as follows:

#! /usr/bin/perl use strict; use MIME::Base64 qw( encode_base64 ); open INFILE, '<', $ARGV[0]; binmode INFILE; open OUTFILE, '>', $ARGV[1]; my $buf; while ( read( INFILE, $buf, 60 * 57 ) ) { print OUTFILE encode_base64( $buf ); } close OUTFILE; close INFILE; __END__

#! /usr/bin/perl 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; __END__

The PDF decoded correctly this time. Thanks!

Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://348967]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-10-26 18:45 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (90 votes). Check out past polls.