perl - Why is '\t', returned from "backtick" call, expanded to tabulator? What all characters are expanded? -


if run simple perl script (on linux, bash),

$to_run = q(echo '\t'); $res = `$to_run`; print $res 

i expect \t printed - is, backslash character , "t" character. indeed, if run in bash

echo '\t' 

i see \t. however, perl script prints tabulator.

why tabulator expanded in $res? characters expanded that? and, importantly, how stop expanding?

backticks evaluated using /bin/sh, regardless of whatever shell may want use, , it's posix xsi-conformant version of echo implemented sh that's converting \t tab. try out running echo '\t' inside sh.

for avoiding behavior, trying using printf '%s\n' instead of echo in backticks.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -