runnig a perl program from a different dir..


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting runnig a perl program from a different dir..
# 1  
Old 11-11-2005
runnig a perl program from a different dir..

hi,

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
in win2000advanced server,...

i have all my perl programs in d drive..
i like to run perl programs from a different drive(ex : c drive..)

that is simple in unix.. but i dont know how to do that in win..

do u know how to do that...

thanks for ur help..
# 2  
Old 11-12-2005
As shown, you can run a Perl script on another drive in the same way:

Code:
D:\Documents and Settings\bernardchan>perl e:\documents\temp\test2.pl
Hello World!

If you have to run a script which depends on other files relative to that dir, you can do a chdir() inside, then the remainder of the script will be relative to that dir:

Code:
chdir "E:\\Documents\\temp";

Hope that I did not misunderstand your question.
# 3  
Old 11-13-2005
still there is a question..

thanks once again cbkihong,
got some ideas,.. but still..

in perl, unix,

write a program, give chmod -577 program, set the PATH variable with program's path.
after that we can run the program from anywhere.. i think its correct..

that's what i need...

i tried this:
-------------------------------------
C:\>type d:\hitest.pl
print "HI";

C:\>perl hitest.pl
Can't open perl script "hitest.pl": No such file or directory
----------
C:\>type d:\hitest.pl
chdir "d:\\";
print "HI";

C:\>perl hitest.pl
Can't open perl script "hitest.pl": No such file or directory
----------------------------------------


thanks again in advance,
# 4  
Old 11-13-2005
Quote:
Originally Posted by sekar sundaram
write a program, give chmod -577 program, set the PATH variable with program's path.
after that we can run the program from anywhere.. i think its correct..
You can emulate this by messing with PATH and PATHEXT. Start your search from here:

http://aspn.activestate.com/ASPN/doc...ent_of_the_she
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. UNIX for Beginners Questions & Answers

Finding Files with Perl on a Hidden Dir?

Greetings! Been a while since I futzed around with Perl, and came upon a minor headscratcher for the community ;) Here's the basic code which I'm trying to make tick over:#!/usr/bin/perl use strict; use warnings; use diagnostics; print " starting "; while (-e "~/.somedir/testFile")... (9 Replies)
Discussion started by: LinQ
9 Replies

3. Shell Programming and Scripting

PERL - Copying ONLY files from one dir to another

I'm writing a Perl script which has its 1st step as to copy files from one directory to another directory. The Source directory has got files with extension, without extension, directories etc. But I want to copy ONLY files with no extension. The files with extensions and directories should not get... (2 Replies)
Discussion started by: jhamaks
2 Replies

4. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

5. Shell Programming and Scripting

PERL count files in a dir

Hi Guys, I need to count files in a dir which were updated yesterday. ls -lth | grep -i 'Jul 7' | wc -l The dir holds files of last 15 days and total count is as 2067476. Is it efficient to count the files using perl? I have developed the following perl script making use of system(). Can... (3 Replies)
Discussion started by: Asteroid
3 Replies

6. Shell Programming and Scripting

Perl command syntax for C:\dir

Hi Everyone, Perl command syntax that would display my ... C:\dir .... Regards, asabzevari (1 Reply)
Discussion started by: asabzevari
1 Replies

7. Shell Programming and Scripting

Runnig a Windows command from UNIX

Hi, I need to execute a Windows command from UNIX crontab ( or similar utility). We are evaluating the schedular applications that will easily solve this issue although it will be a while by the time the tool selection happens and I need something to implement this solution in the iterim. ... (1 Reply)
Discussion started by: ashpon
1 Replies

8. UNIX for Dummies Questions & Answers

Runnig Remote Shell

Please I need your help. I want to run remotely a unix shell that run a java process, from a Visual Basic Client. Thanks mac33 :) (4 Replies)
Discussion started by: mac33
4 Replies

9. UNIX for Dummies Questions & Answers

HP 9000 runnig Unix

I have aquired the dutties of looking after our MRP system We have a HP 9000D running Unix With MINX as tha MRP system Our last IT System adim. had crashed the system before he left and sense then we have not been able to log on to the system at the console or remotely. tha error reads minx... (6 Replies)
Discussion started by: bstrin
6 Replies

10. IP Networking

runnig squid at boot up

Hi Does any body know how i can run a program at bootup? I have squid (cache server) installed on my PC but after boot up i should run it manually but i want it to run automaticly is there a way? I used to do it by entering the address ina file but i've forgotten it now. But i remember that ... (2 Replies)
Discussion started by: hessam
2 Replies
Login or Register to Ask a Question