in reply to what is difference between chr and oct?
My question is why perl do not support chr('0b'.$1)Because chr takes a number as an argument. You pass it a string - a string that doesn't look like a number. The "0b" only works for numeric literals, or arguments to oct and hex. '0b' . $1 is not a literal.
Is there a way to convert a string to number explicitly like perl6?eval, as in
$string =~ s/ (\d+)/chr eval "0b$1"/egx;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: what is difference between chr and oct?
by xiaoyafeng (Deacon) on Jul 12, 2010 at 17:36 UTC | |
by afoken (Chancellor) on Jul 13, 2010 at 02:24 UTC | |
by xiaoyafeng (Deacon) on Jul 13, 2010 at 15:04 UTC | |
by JavaFan (Canon) on Jul 13, 2010 at 15:29 UTC |