Following snippet
displays this output:
It is my understanding that the length function includes all escape characters, but that the dot drops the newline characters. Both seem to include the backspace character which apparently does not erase the preceding character in the string assigment.
Are these valid assumptions?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
Code:
$str="\nabc d\bef z\n";
print "\$str $str has ".length($str)." characters\n";
$cnt=0;
while ($str=~/./g){$cnt++};
print "or has it $cnt characters?\n";
Code:
$str
abc def z
has 12 characters
or has it 10 characters?
It is my understanding that the length function includes all escape characters, but that the dot drops the newline characters. Both seem to include the backspace character which apparently does not erase the preceding character in the string assigment.
Are these valid assumptions?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]