qw is for taking a set of tokens, separated by whitespace, and returning a list. You're assigning into a scalar, which makes no sense. In this case, it will give you the last value in the list, which is "Files\Rational\ClearCase...". I think you meant q instead of qw.
<br><br> my $commLine = q!"\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe"!;<br><br>might do what you want. Although you might want to check if Windows will let you use forward slashes instead of backslashes; if so, you can use:
<br><br> my $commLine = q!"/Program Files/Rational/ClearCase/bin/clearexplorer.exe"!;<br>
<br>Another option to avoid the problem of quoting is to prevent system from passing the command to the shell. If you had any command-line arguments, that would be easy, but since you don't, you can force it with the bizarre
<br><br> my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!;<br> system {$commLine} $commLine;<br><br>This uses the first $commLine as the program to run, and the second to tell the OS what the name of the program that you're running is (in case you want to lie.) So this should also work:
<br><br> my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!;<br>
system {$commLine} "clear explorer, dude";<br>
<br>Strangely, further arguments come after the second one. So if you were to pass in the value 12, this would become:<br><br>
my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!;<br>
system {$commLine} "blahblah", "12";<br><br>or<br>
<br><div> my $commLine = q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!;<br>
system {$commLine} ("blahblah", "12");<br>
<br>Except in that case, you have a command line argument, so it's much easier:<br><br> my @command = (q!\\Program Files\\Rational\\ClearCase\\bin\\clearexplorer.exe!, "12");<br>
system @command;<br><br><span class="gmail_quote">On 1/22/07, <b class="gmail_sendername"><a href="mailto:nheller@silcon.com">nheller@silcon.com</a></b> <<a href="mailto:nheller@silcon.com">nheller@silcon.com</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Here's a short example script. My system can't find the executable. I'm
<br>sure there must be an easy solution - but what?<br><br>#!Perl -w<br><br>use warnings;<br>use strict;<br><br>my $commLine = qw "\"\\Program<br>Files\\Rational\\ClearCase\\bin\\clearexplorer.exe\"";
<br><br>system $commLine;<br><br>my $foo = 1;<br><br>Neil Heller<br><br><br>> On Sat, Jan 20, 2007 at 02:12:12PM -0800, Michael Friedman wrote:<br>><br>>> Sometimes it pays to ask the seemingly obvious question...
<br>>> Did you try putting the path in quotes?<br>><br>> Exactly my thought.<br>><br>>> How about escaping the space? "Program\ Files".<br>><br>> In Windows, I believe, you'd have to do something like this:
<br>><br>> system qq{chdir "Program Files"};<br>> # or<br>> system qq{chdir "$dir"};<br>><br>> --the reason being that the Windows command shell doesn't have single<br>
> quotes the way bash (for instance) does.<br>><br>> Caveat hacker: I don't have a Windows box, so I didn't test this. I'm<br>> just going from memory.<br>><br>> --<br>> Quinn Weaver, independent contractor | President, San Francisco Perl
<br>> Mongers<br>> <a href="http://fairpath.com/quinn/resume/">http://fairpath.com/quinn/resume/</a> | <a href="http://sf.pm.org/">http://sf.pm.org/</a><br>> _______________________________________________<br>
> SanFrancisco-pm mailing list<br>> <a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>> <a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
</a><br>><br><br>_______________________________________________<br>SanFrancisco-pm mailing list<br><a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm">
http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br></blockquote></div><br>