Hello Monks,
I am trying to pass a delimiter string via a command line argument like this :
./script.pl "\t" ARG1 ARG2
so inside the script I would like to set the $" to do some interpolation on a list like this :
my $delim = shift @ARGV;
$" = $delim;
...
print "@list";
but with any of the backslashed characters what prints is something like this :
list_item1\tlist_item2\tlist_item3
and not what I am going for which is to have the line print tab-delimited, in this case :
list_item1 list_item2 list_item3
I don't understand why this happens because if I set the delimiter in the script like this :
$" = "\t"
everything is fine. I have tried every kind of escaping or quoting I can think of and nothing seems to work.
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.