http://www.perlmonks.org?node_id=998289

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

sub Parse{ my $self = shift; my $html_code = shift; my $te = HTML::TableExtract->new( headers => [qw(Severity Advi +sory Synopsis Date)] ); my @args = (); $te->parse_file($html_code); foreach my $ts($te->tables) { foreach my $row ($ts->rows) { push(@args,("\'".join('\',\'',@$row)."\'\n")); } } return @args; }

Hi Monks, I want to run the above subroutine by passing command line arguments to it. How shd i do that. Plz help

Replies are listed 'Best First'.
Re: how do i run this subroutine
by Corion (Patriarch) on Oct 10, 2012 at 19:11 UTC

    So, what have you tried? Have you had a look at perlrun already?

      suppose the filename is abc.pl . I ran the script with the command ./abc.pl I need to pass the url as an argument . How do i do that? Thanks
Re: how do i run this subroutine
by NetWallah (Canon) on Oct 10, 2012 at 19:29 UTC
    Command line arguments are available inside the script as the pre-defined variable @ARGV .

    This array can be passed to the subroutine.

                 I hope life isn't a big joke, because I don't get it.
                       -SNL

      I am sorry but i couldnt understand how to pass @ARGV to the subroutine . I started learning perl few days back ..Could you please show me the command to do it .
        Do you know how to pass a variable to a subroutine? @ARGV is a variable. Pass it to the subroutine. Or pass $url as toolic derived above.
        Parse (@ARGV); # Parens are optional.

                     I hope life isn't a big joke, because I don't get it.
                           -SNL