Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to define a directory variable with '&' and spaces in the name?

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
0
0
US
Hi,

What would be the right way to declare a variable, say, HOME_DIR, if the folder name has an '&' symbol and spaces? For example, here is the Windows folder I need to declare into a variable:

S:\Parent Folder\Parent 1 & Parent 2\Child


Thanks,

Mike
 
Use single quotes like this:
$var = 'S:\Parent Folder\Parent 1 & Parent 2\Child';
 
use the quote operator q{}:

$HOME_DIR=q{S:\Parent Folder\Parent 1 & Parent 2\Child};
print $HOME_DIR . "\n";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top