Running perl script from command line

Discussion in 'Perl Misc' started by Abhishek Srivastava, Feb 5, 2004.

  1. Hello All,

    I am using active state perl on windows xp. I keep all my perl scripts
    in a directory called "c:\myapps\perl\" I have put this directory into
    my system PATH.

    now to run these scripts I want to go to the console and say

    myscript.pl a b c [here a b c are the parameters to the script]

    I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
    windows explorer file->folder options)

    When I run my script something strange happens, the script is run but
    none of the command line parameters are passed to it.

    Why are the command line params not being passed to my script?

    I am sure someone would have tried this out if you use perl on a
    windows machine.

    Thanks a lot for your help.

    regards,
    Abhishek.
     
    Abhishek Srivastava, Feb 5, 2004
    #1
    1. Advertising

  2. Abhishek Srivastava

    ko Guest

    Abhishek Srivastava wrote:
    > Hello All,
    >
    > I am using active state perl on windows xp. I keep all my perl scripts
    > in a directory called "c:\myapps\perl\" I have put this directory into
    > my system PATH.
    >
    > now to run these scripts I want to go to the console and say
    >
    > myscript.pl a b c [here a b c are the parameters to the script]
    >
    > I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
    > windows explorer file->folder options)


    Its easiest to let the install program create the file association...

    > When I run my script something strange happens, the script is run but
    > none of the command line parameters are passed to it.
    >
    > Why are the command line params not being passed to my script?
    >
    > I am sure someone would have tried this out if you use perl on a
    > windows machine.
    >
    > Thanks a lot for your help.
    >
    > regards,
    > Abhishek.


    In the HTML documentation that comes with AS:

    ActivePerl FAQ->Windows Specific->Windows NT/2000 and Windows 9x, the
    'How do I associate Perl scripts with perl?' section.

    HTH - keith
     
    ko, Feb 5, 2004
    #2
    1. Advertising

  3. On Thu, 05 Feb 2004 00:47:02 -0800, Abhishek Srivastava wrote:

    <snip>
    > When I run my script something strange happens, the script is run but
    > none of the command line parameters are passed to it.
    >
    > Why are the command line params not being passed to my script?

    <snip>

    Code would be helpful :)

    *How* are you parsing the command line options in your script?

    --
    Jim

    Copyright notice: all code written by the author in this post is
    released under the GPL. http://www.gnu.org/licenses/gpl.txt
    for more information.

    a fortune quote ...
    Honesty pays, but it doesn't seem to pay enough to suit some
    <people. -- F. M. Hubbard
     
    James Willmore, Feb 5, 2004
    #3
  4. On 5 Feb 2004 00:47:02 -0800, (Abhishek
    Srivastava) wrote:

    >myscript.pl a b c [here a b c are the parameters to the script]
    >
    >I have also assosiated *.pl extension with c:\perl\bin\perl.exe (using
    >windows explorer file->folder options)
    >
    >When I run my script something strange happens, the script is run but
    >none of the command line parameters are passed to it.


    First of all AS Perl comes with extensive documentation that covers
    *also* these issues. But how can you tell that cmd line params are not
    passed to the script? What does

    perl -le "print for @ARGV" <args>

    yield? And if you put this code in a file, say myprog.pl, what does

    myprog.pl <args>

    yield?


    Michele
    --
    you'll see that it shouldn't be so. AND, the writting as usuall is
    fantastic incompetent. To illustrate, i quote:
    - Xah Lee trolling on clpmisc,
    "perl bug File::Basename and Perl's nature"
     
    Michele Dondi, Feb 7, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,831
  2. Casey T
    Replies:
    2
    Views:
    391
    Casey T
    Mar 13, 2008
  3. Ting Wang
    Replies:
    3
    Views:
    203
    Paul Lalli
    Dec 13, 2005
  4. Replies:
    4
    Views:
    305
    ccc31807
    Jul 29, 2011
  5. A.Rock
    Replies:
    0
    Views:
    373
    A.Rock
    Apr 10, 2013
Loading...

Share This Page