A
ikegami said, . and
system are different, but it looks like you do not appreciate what either do.
The shell 'dot' command . (also known as 'source' in Bash and C shell) asks the
current shell to execute the shell statements within the specified file. There are ways to do the same thing with Perl, but only with Perl statements (although Perl does allow inline statements from languages like C and Java). You only need read access on the file being used, since the shell is reading the statements as if you were typing them in. The most common reason for using the 'dot' command is to set environment variables in the current shell. The syntax for doing this in shell and Perl are very different, so even if you did
do this in Perl it wouldn't work.
When you run a script from a shell, for example by typing ./
script_name you will see that you need execute access on the script because it will run in another process. That is also what
system does, and yours might be failing because of permissions (try chmod u+x
script_name), or because the file is not in a directory which is in the PATH environment variable (echo $PATH, or specifiy the current directory). Any environment variables set in this way will only affect the new process - child processes run with a sort of filewall around them so they do not accidentally clobber anyone else.
You do not say what your error message is, nor do you say why you are executing the 'dot' command. If you did then we might be able to help further.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.