I don't see
$cipher->finish anywhere. Read the
Crypt::CBC man page.
$cipher->finish must be called after the last
$cipher->crypt() to flush the buffer out. That's why the last line isn't making it to the file.
Update:I think I need to elaborate.
if ($mode == 0) {
open(INFILE, "<$inFile") || die "Error opening source file for inp
+ut! \n";
open(CRYPTFILE, ">$cryptFile") || die "Error opening crypt file fo
+r output! \n";
$cipher->start('encrypting');
while (<INFILE>) {
print CRYPTFILE $cipher->crypt($_);
}
print CRYPTFILE $cipher->finish;
close INFILE;
close CRYPTFILE;
BMaximus