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. Simple Website Monitoring Script in Perl
    By tuxette in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 01-15-2009, 05:03 PM
  2. Simple Website Monitoring Script in Perl
    By peter in forum Tutorials
    Replies: 0
    Last Post: 11-24-2008, 04:59 AM
  3. Gcc options & prelink
    By comtux in forum Linux - General Topics
    Replies: 5
    Last Post: 11-25-2004, 10:29 AM
  4. Sound Options
    By vwgtiturbo in forum Linux - Hardware, Networking & Security
    Replies: 3
    Last Post: 12-06-2002, 07:01 PM
  5. perl question from a perl newb
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 09-06-2002, 01:16 AM

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
  •