sandy1028 has asked for the wisdom of the Perl Monks concerning the following question:

How to pass directoryname and command line as an argument when executing the filename file.pl update directoryname/error.txt directoryname/filename.txt >& directoryname/filename.log

Replies are listed 'Best First'.
Re: Pass arguments
by imrags (Monk) on Jan 23, 2009 at 06:35 UTC
    Hmm...Please reformat your question so that it is readable
    Check this Perl Monks Approved HTML tags and Writeup Formatting Tips in perl monks to help you format your question better.
    I'd suggest to command line argument Perl and look at a few results as well...
    Anyway the answer might be hidden in
    @ARGV
    The array @ARGV contains the command-line arguments
    intended for the script. $#ARGV is generally the number
    of arguments minus one, because $ARGV[0] is the
    first argument, not the program's command name itself
    Raghu
Re: Pass arguments
by Bloodnok (Vicar) on Jan 23, 2009 at 11:17 UTC
    Only the shell knows about elements on the command line beyond any re-direction, so in the command line invocation
    file.pl update directoryname/error.txt directoryname/filename.txt >& d +irectoryname/filename.log
    , directoryname/filename.log is not (directly) accessible to the script.

    Given that your script knows its own PID ($$), you may be able to parse it [the full command line] from the process tree e.g. by parsing the output from ps -fp $$...

    A user level that continues to overstate my experience :-))