On 01/09/2007 12:49 AM, [EMAIL PROTECTED] wrote:
Hi,
I need to run a particular command  "cleartool des " from a partiuclar
folder.
For example:
I need to get into directory m: cd \ Arun_Main and then run cleartool des
$temp .

I wrote the following code for this

foreach $temp(@vob2)
{
qx(m: cd \\Arun_Main);
$x = qx(cleartool des $temp);
$hash{$temp} = $x;
}

I ran this code from command prompt c:

But the above code seems to act the following way:
It goes into dir Arun_Main in line 3. But comes back to c: in line 4 and
tries to run the command cleartool des $temp from c: instead of m: cd
\\Arun_Main.

Can anyone please help me out to sort this problem ?

[...]

Try this:

use Cwd;
my $oldpwd = getcwd();
chdir "m:/Arun_Main";

foreach my $temp (@vob2)
{
        my $x = qx(cleartool des $temp);
        $hash{$temp} = $x;
}

chdir $oldpwd;

-------------
Read the docs:
perldoc -f chdir
perldoc Cwd





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


Reply via email to