|XP is just a number|
Octal Weirdnessby HaB (Sexton)
|on Dec 20, 2000 at 01:59 UTC||Need Help??|
HaB has asked for the
wisdom of the Perl Monks concerning the following question:
Working on a server app that receives incoming text messages, and sends back a corresponding ACK message based on certain data contained in the incoming msg. The incoming msgs are encapsulated with a start block and an end block, which can be specified in a config file that the server reads its options from. These blocks are specified by the octal value of the ascii character. For example, the start block could be a vertical tab (\013) and the end block a serial field-separator (\034). The corresponding entry in the config file would be:
The config file is read in a runtime, and stored in a hash, so those 2 vals would go in as
Now, in order to facilitate message parsing, as soon as an incoming message is received, these chars are stripped out of the message like so:
which works just fine. The problem shows up when I try to build the ACK message. It also needs to be encapsulated by the same two chars. I have tried all of the following:
all with the same result. The ACK message ends up using the literal '\013" instead of the v-tab. Same with the '\034'.
What gives? I can't understand why it would work perfectly in one regex, and fail in the other. I'm assuming it's some sort of regex internal thing I don't know about. Any enlightenment would be most appreciated.