ok i was so stupid to cut and paste your suggestion in my code.. i speak too generic like in 'does not work'.. maybe my original idea is stupid/unpractical/bogus prone/or worst...
but really no one understand what i'm asking for?
I have changed the dispatch table in this way:
my %cmds = ( a => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @ARG
+V', @_},
b => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @ARG
+V', @_},
b1 => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @_'
+, @_},
b2 => sub {exec 'perl', '-e', 'print qq!@ARGV!', @_},
c => sub {my $res; foreach (@ARGV) {$res+=$_}; print $res
+;exit 0 },
);
##
# calling with --key a b b1 b2 like in
# dispatch.pl --execute --key a A B C
# everytime produces:
#
#ole
#--a blank line--
#only the c key runs as expected (to me) but not use exec
#c:\SCRIPTS>dispatch.pl --execute --key c 1 2 3 4 5
#ole
#15
#c:\SCRIPTS>
#key c in a pipeline produces:
#c:\SCRIPTS>echo 1 2 3 | dispatch.pl --execute --key c
#ole
#Use of uninitialized value $res in print at c:\SCRIPTS\code-dispatch.
+pl line 16.
c:\SCRIPTS>
sorry about my errors
in any case thanks for the attention
L*
there are no rules, there are no thumbs..
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.