Results 1 to 4 of 4

Thread: PERL: X-ecute script w/ options on cmd line

  1. #1
    Senior Member
    Join Date
    Apr 2002
    Posts
    417

    PERL: X-ecute script w/ options on cmd line

    Hi,

    I have this perl script that will parse info from a couple of files.

    I could use $filenames = <STDIN>

    to ask for the files when it runs but Id like to be able to possibly follow the script by the name fo the files like in bash scripts for example

    $> perl parsingscript.pl filename1 filename2 another_value

    Is this possible or is it easier to do it w/ a bash script?

    thanx,

  2. #2

    Re:PERL: X-ecute script w/ options on cmd line

    You can use @ARGV to pass information into the script ....

    Code:
    #!/usr/bin/perl
    
    my $filenumber = scalar(@ARGV);
    print "You asked me to open $filenumber files";

  3. #3

    Re:PERL: X-ecute script w/ options on cmd line

    [quote author=Ashcrow link=board=9;threadid=4529;start=0#45316 date=1029005482]
    Code:
    #!/usr/bin/perl
    
    my $filenumber = scalar(@ARGV);
    print "You asked me to open $filenumber files";
    [/quote]

    Code:
    #!/usr/bin/perl
    
    print "And those files are named: ";
    foreach(@ARGV) {
      print "$_ ";
    }
    print "\n";

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    417

    Re:PERL: X-ecute script w/ options on cmd line

    Yup that's pretty cool.

    thanx,

Similar Threads

  1. Firewall script in RHEL 4
    By sud.tech in forum Programming
    Replies: 8
    Last Post: 06-12-2008, 01:07 PM
  2. Rsync incremental backup script
    By vwgtiturbo in forum Programming
    Replies: 6
    Last Post: 06-07-2006, 08:19 PM
  3. Perl module problem
    By Outlaw in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 05-04-2005, 02:17 PM
  4. Drawing Tools: Pencil, Line, Arc, Freeform,
    By The Donald in forum Windows - General Topics
    Replies: 0
    Last Post: 01-05-2005, 06:27 AM
  5. Shell Script to modify apachectl
    By gaxprels in forum Programming
    Replies: 6
    Last Post: 07-23-2002, 07:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •