AndrewMcHorney wrote:
Hello

Hello,

I am working on a perl script and inside the script I am building a string. However the backslash does not appear.

Here is the code:

$DirCommand = "dir".$CurrentDrive.":\ /S"; where $DirCommand = "c"

I am expecting the results to be dir c:\ /S but my results are dir c: /S

This affects the execution of the command.

What did I miss putting in?

Double quoted strings are interpolated so you need to either escape the backslash:

$DirCommand = "dir".$CurrentDrive.":\\ /S";

Or use single quotes to avoid interpolation:

$DirCommand = "dir".$CurrentDrive.':\ /S';



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to