in reply to How to read encrypted data from informix database into a single variable

I could be going it alone (in which case: sorry); but I don't seem to understand what doesn't work or what it is that you intend undef $/ to do. I don't think $/ applies in any way when using DBI, but I could be mistaken about that too.

Do you want to somehow escape the newlines before writing them to ki_file.txt?

You'd have to pick some standard way to do so if that's what you're intending. Personally, I'd probably choose to dump a hex or base64 representation to file:

# note that part of your trouble could be your antiquated file-handle +representation (doubtful). open my $output_file, ">", "ki_file.txt" or die $!; # unpack can be a little arcane... print $output_file unpack("H*", $ki_token), "\n";

The best document on unpack is actually pack. Please correct me if I've completely missed the point of the question.

-Paul

Replies are listed 'Best First'.
Re^2: How to read encrypted data from informix database into a single variable
by Dev (Initiate) on May 15, 2007 at 13:28 UTC

    @jettero : I am working with archaic system and new to Perl :) Yes, i thing i will try to dump a hex and work on it. It sounds better. I will give it a shot.

    I have taken, hex unload to a file. It contains around 25,000 records. It is not possible to extract a single record (unique keys are such, that i cannot use them at runtime). So now i want to read , 32 bytes of this file ( the hex dump) at a time (in an scalar variable) and skip 2 bytes after - each 32 byte read. can you suggest me a way to do this!

      You generate the output file yourself, so I'd make sure to only write 32bytes per line — while simultaneously avoiding writing the two mystery bytes — and just read them back in that way. no?
      while(<$input>) { chomp; my $var = pack("H*", $_); die "holy smokes, my hex-dump file is bad" unless length $var == 3 +2; }

      -Paul

        Analysing hex dump, was good idea. It simplified lot of things. I took, unload of encrypted data in an file. And then from byte patterns and using simple read() and seek(), i was able to extract the actual encrypted data bytes as i intended to do. Thank you for your inputs :) . have a nice day