print, put, say and escape characters

  • A+

According to the docs, the only difference between print and say seems to be the fact that the latter adds "/n" (and stringifies using .gist. However,

perl6 -e 'print "del/b/b"' 

prints "d", effectively applying escape characters, while

perl6 -e 'put "del/b/b"' 

will output "del" (the same as say). Is it possible that there's a third way of stringifying strings, besides .gist and simple .Str?

As a matter of fact, any character behind the /b will make them behave in the same way. So any idea of why this happens?


FWIW, I see "del" in both cases, regardless of using print or put, so maybe there is some terminal setting that is affecting the behaviour?

The /b/b only become obvious when you actually put characters after them:

say "del/b/bo the right thing"  # do the right thing 

/b only moves the cursor back one position. It does not erase anything by itself. If you want the characters erase, you'd have to have them followed by spaces, and then backspace again if you want any text after that again:

print "del/b/b  /b/b"           # d 


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: