my $key = 'ThisIsMyKey'; my $cipher = Crypt::Blowfish->new($key); my $buffer; my $file = 'TestFile.txt'; open(my $in, "<", "$file.crypt") or die "Couldn't open '$file' for read: $!"; open(my $out, ">", "$file.decrypt") or die "Couldn't open '$file.decrypt' for write: $!"; while( read($in, $buffer, 8) ) { print $out $cipher->decrypt($buffer); }