in reply to Octal Weirdness
The only reason that:
works is because your strings go through an extra interpolation phase when used in a regex.$in_msg =~ s/$config{'startblock'}//g; $in_msg =~ s/$config{'endblock'}//g;
When you say that your variables end up getting set like:
you are wrong. In Perl, "\013" would give you a single character while your values are being read from a file so the values end up being 4 characters like '\013' or "\\013" would give you.$config{'startblock'} = "\013"; $config{'endblock'} = "\034";
If you want \ to mean something special when used in your config file, then you'll have to add code to provide that special meaning. For example:
could be applied to such values to parse \0 octal escapes.s#\\(0[0-7]*)#pack("C",oct($1))#ge
Updated as if via s/octal/oct/ to correct the bug noted by japhy. Thanks, japhy.
- tye (but my friends call me "Tye")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Octal Weirdness
by japhy (Canon) on Dec 20, 2000 at 05:14 UTC | |
|
Re: (tye)Re: Octal Weirdness
by repson (Chaplain) on Dec 20, 2000 at 10:00 UTC | |
by tye (Sage) on Dec 20, 2000 at 21:12 UTC |