Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

Comment on how do i run this subroutine
Download Code
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 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 (Abbot) 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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-07 04:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls