Dev has asked for the wisdom of the Perl Monks concerning the following question:
I want to read a field of char(32) type, from an informix database table.And contents of this field, is in encrypted form.So it contains, new line characters also. I want to dump contents from this field(as it is) into a single variable and later use the same, for decrypting it.
Part of what i have done is , as follows , But it is'nt working as intended because of new line characters.
open (ki_file, ">ki_file.txt") or die ("\n\nCould not open file. $!\n\n"); # Open file to dump ki_token from table print "\n ki_file.txt opened for output\n"; undef $/; # Undefining end of record character $stmt = "SELECT ki from imsi_period where imsi_id=346 "; # ki is field, containing encrypted data $sth = $dbh->prepare($stmt); $sth->{ChopBlanks} = 1; $sth->execute(); $sth->bind_col(1,\$ki_token,{TYPE => SQL_CHAR}); while ($sth->fetch) { # print $ki_token; print ki_file ($ki_token); print "Ki_Token is written to ki_file.txt." } $/ = "\n"; # Restore end of record character for normal beha +viour later close (ki_file); # Close file ......
|
|---|