Click here to get back home

can the script find itself?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
can the script find itself? fossildoc 04-06-2008
Posted by fossildoc on April 6, 2008, 11:53 am
Please log in for more thread options
I'm running build 813 on 'doze XP/Home. I want my Perl script to
determine the directory from which it was run. This is equivalent to
retrieving the command line. For example, from a DOS window I type:
>\perl\bin\perl c:\mydir\myscript.pl
I want the script to be able to retrieve the string "c:\mydir".

There is a Win32 function, Find, that can look for files, but it only
searches the INC directories, so it is not reliable.

Any ideas, please.

Posted by Frank Seitz on April 6, 2008, 11:55 am
Please log in for more thread options
fossildoc wrote:
> I'm running build 813 on 'doze XP/Home. I want my Perl script to
> determine the directory from which it was run. This is equivalent to
> retrieving the command line. For example, from a DOS window I type:
>
>>\perl\bin\perl c:\mydir\myscript.pl
>
> I want the script to be able to retrieve the string "c:\mydir".
>
> There is a Win32 function, Find, that can look for files, but it only
> searches the INC directories, so it is not reliable.
>
> Any ideas, please.

perldoc FindBin

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by fossildoc on April 6, 2008, 12:24 pm
Please log in for more thread options
>
> perldoc FindBin
>
> Frank
> --

Thanks, Frank. It works fine.


Posted by Petr Vileta on April 7, 2008, 10:27 pm
Please log in for more thread options
fossildoc wrote:
> I'm running build 813 on 'doze XP/Home. I want my Perl script to
> determine the directory from which it was run. This is equivalent to
> retrieving the command line. For example, from a DOS window I type:
>> \perl\bin\perl c:\mydir\myscript.pl
> I want the script to be able to retrieve the string "c:\mydir".
>
> There is a Win32 function, Find, that can look for files, but it only
> searches the INC directories, so it is not reliable.
>
> Any ideas, please.

$0 can't to help you?


--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>


Similar ThreadsPosted
How can script find its host's name/IP address? December 23, 2004, 3:54 am
any script to find renamed wmf files? January 2, 2006, 12:06 pm
Script to find largest files November 1, 2007, 10:15 am
script to find the files with very long names June 12, 2006, 3:34 am
Script to find unique words in a document July 26, 2006, 3:29 pm
Regex help, need to find all "