The problem here is that "\t" is not interpreted by the shell to be a tab character, but just a regular backslash followed by a "t":
> echo "\t"
\t
Perl also doesn't interpret this input as a tab, because that would make it impossible to have strings with a literal "\t" sequence. \escape sequences are only interpreted in double quoted string literals (and regular expressions).
The way to pass special characters in bash is to use $'\code', ie $'\t' for tab:
> perl -e '$"=shift;print "@ARGV"' $'\t' a b c d e
a b c d e
If you use another shell, look in its documentation.
Ofcourse you could also do $" = eval '"'.shift(@ARGV).'"'; but that would complicate matters if anyone needs to pass something that can't be put in double quotes.
update: fixed typo
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.