Hello monks,

I am new to perl and trying to write a script which is having a subroutine and it takes as an input 2 parameters and gives one prints output the code is as follows

#!/usr/bin/perl BEGIN { unshift (@INC,"/view/sawans1_api_test/vobs/pp2dev/src/testsuite/user/t +inc"); unshift (@INC,"/view/sawans1_api_test/vobs/pp2dev/src/testsuite/user") +; } use LWP::Simple; use DHPL::System; use nightly::common; use Logs::LogReader; sub get_user_scenario_desc{ my($web_link, $us_name) = @_; if($web_link =~ m/nightly_results(.*?)(.html)/) { $web_link= "/nightly_db".$1; } `rcp lcla238.lss.emc.com:$web_link`; my $file = "/tmp/nightly_db.html"; my $sul = SuiteLog->new( { FILE => $file } ); # $logfile is the log f +ile of test run $sul->parse_suite( ); # get_scheduled will return the list of all the test_suites present in + the respective test_run foreach my $sname ( @{$sul->get_scheduled( )} ) { my $scl = $sul->get_log( $sname ); my $name = $scl->name( ); my $result = $scl->result( ); my $errors = $scl->log_errors_short( ); my $description = $scl->get_decription( ); if($name eq $us_name){ print"Test Scenario Name = $name\n"; print"Result = $result\n"; print"Errors = $errors\n"; print"Description = $description\n"; } } }

Here I wanted to pass the two inputs to the subroutine defined above..I tried like this

perl UserScenarioDesc.pl &get_user_scenario_desc("http://some_link/XYZ +.html","testdare/UserScenarioDAREtestCkmadm")

And I got error like this

-bash: syntax error near unexpected token `"http://some_link/XYZ.html","testdare/UserScenarioDAREtestCkmadm"'

As I am prttt new to perl can anybody tell me how to call such subroutine with parameters from command line???

Thanks in advance !!!


In reply to calling paramaterized subroutine by siddheshsawant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.