How to get command line parameters?

Discussion in 'Perl' started by Tal Raveh, Jun 13, 2004.

  1. Tal Raveh

    Tal Raveh Guest

    Hello



    I'm writing script for sending mail, I want to get from command line all I
    need for that



    Ext.

    Script name: sendmail.pl

    I want to run:

    ../Sendmail.pl –F <from address> -t <to address> -m <massage> -s <subject>



    I have 4 parameters:

    $mailfrom

    $mailto

    $msg

    $subject



    How can I put the command line parameter in those parameters ?



    Thanks



    Tal
    Tal Raveh, Jun 13, 2004
    #1
    1. Advertising

  2. Tal Raveh wrote:
    > I want to run:
    >
    > ./Sendmail.pl –F <from address> -t <to address> -m <massage> -s <subject>
    >
    > I have 4 parameters:
    >
    > $mailfrom
    > $mailto
    > $msg
    > $subject
    >
    > How can I put the command line parameter in those parameters ?


    Read about the @ARGV variable in "perldoc perlvar".

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Jun 13, 2004
    #2
    1. Advertising

  3. Tal Raveh

    Ralf Wahner Guest

    Or refer to the 2nd ed. of the Perl Cookbook: "15.1 Parsing Program Arguments"
    Ralf Wahner, Jun 14, 2004
    #3
    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. Jonck van der Kogel
    Replies:
    2
    Views:
    967
    Jonck van der Kogel
    May 27, 2004
  2. magda muskala
    Replies:
    0
    Views:
    606
    magda muskala
    Feb 15, 2005
  3. Kenneth P. Turvey
    Replies:
    1
    Views:
    375
    Paul Hamaker
    Feb 25, 2006
  4. qazmlp
    Replies:
    7
    Views:
    537
    Adrian
    Oct 31, 2004
  5. hal styli
    Replies:
    6
    Views:
    380
Loading...

Share This Page