I am trying to change the working directory (for configure a WebShpere MQ Queue manager) using Perl in UNIX.
I have to go to the directory /var/mqm/qmgrs/Q\!MAN
and I have used following code snippet:
$QueueManagerPathName = 'Q\!MAN';
chdir('/var/mqm/qmgrs/'.$QueueManagerPathName) or die "Cannot change to dir : /var/mqm/qmgrs/".$QueueManagerPathName."\n";
But it does not change the directory and dies giving
Cannot change to dir : /var/mqm/qmgrs/Q\!MAN
When i remove the variable $QueueManagerPathName
its working fine and it concludes me that it would be error using "\!"
part.
You don't need to escape
!
in the directory name. This should work: