Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

how do i run this subroutine

by kurtcobain (Novice)
on Oct 10, 2012 at 19:09 UTC ( #998289=perlquestion: print w/replies, xml ) Need Help??
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 (Pope) 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 . I ran the script with the command ./ 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.

      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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://998289]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-08-16 19:27 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (171 votes). Check out past polls.