how to call such subroutine with parameters from command line?
In theory, you could write
$ perl -e 'do "UserScenarioDesc.pl"; get_user_scenario_desc("http://so +me_linkXYZ.html","testdare/UserScenarioDAREtestCkmadm");'
Or, illustrated with a shorter, self-contained example:
#!/usr/bin/perl # 830179.pl sub foo { print "foo(): @_\n"; } print "bar\n";
$ perl -e 'do "./830179.pl"; foo("arg1", "arg2");' bar foo(): arg1 arg2
The argument to the option -e (the part between single quotes) is a mini Perl script in which the do loads/compiles/runs the script. After that, the foo() function within the script is being called.
However, as others have said, what you most likely really want is to pass arguments to the script, and not invoke a routine in it from the command line.
In reply to Re: calling paramaterized subroutine
by almut
in thread calling paramaterized subroutine
by siddheshsawant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |