Passing a tab as a command line argument using system function

ming-wen
ming-wen used Ask the Experts™
on
I have trouble of running another PERL script inside of PERL script and passing a tab as a command line argument.  For example, the following is what I would like to do

$command = "PERL second_script.pl \"     \"";
system $command;

However, after tab is passed into the second script, the second script actually sees it as a space.  

What should I do to make it correct?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
try using the escape character for a tab instead, which is "\t".

Programming languages do not understand tabs by pressing tab unlike a word processor. A tab is either nothing or just a space in source code. You need to use the escape characters for such situations. However, on running the program, the keyboard tab input will be converted and recognized as a tab (but not when typing the source code)

so your code would be this:

$command = "PERL second_script.pl \"\t\"";

Author

Commented:
Have tried but it gives the same result (still sees it as a space).

Author

Commented:
Have tried but it gives the same result (still sees it as a space).
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
@command = ("PERL","second_script.pl","     "_;
 system @command;
Most Valuable Expert 2014
Top Expert 2015
Commented:
@command = ("PERL","second_script.pl","     ");

Author

Commented:
Not quite right.  It should be

@command = ("PERL", "second_script.pl", "\"     \"");

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial