in reply to Binary Reading Questions
The trick you're trying to use derives from C treating chars as eight-bit signed integers, aka chars. This is C's approach, which isn't in many other languages, among which you find Perl. That's why you're forced to use ord to perform the conversion.
Remember that variables are not "strongly" typed in Perl, so it actually doesn't know what a single character is; moreover, Perl supports implicit conversions between stringed numbers and the numbers they represent (e.g. "123" is also read as 123 in numeric contexts, like in a sum), so you would end up with a problem trying to auto-convert a single-char variable like "1": is it 1 or is it 49? C goes the latter, Perl chooses the former.
As a rule of thumb: Perl is definitively not C (even if it behaves friendly to those who know C :)
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|