in reply to Re^2: How to open a file in hexadecimal form?
in thread How to open a file in hexadecimal form?

<code></code> tags are the preferred way to post formatted plain text here.

The input record separator needs to be set to something, and 8kb is a reasonable value. It shouldn't be "\n" because you might not have any. But you can use it for your new problem:

$/ = '1397'; # You don't have to specify the hex numbers; it's all th +e same to Perl while (<>) { # 1397 appears at the end of the record, if at all # so an anchored search-and-replace handles it s/1397$/\0\0\0\0/; }

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^4: How to open a file in hexadecimal form?
by 5mi11er (Deacon) on May 12, 2005 at 14:25 UTC
    That's some pretty wicked Perl foo :-)

    -Scott