R
Rusty
Greetings,
My problem is I need to call a subroutine but the number of args can be
many and vary from call to call. What I'm trying to do is parse a
template and capture the data from the template into a scalar and then
call the subroutine with the scalar value and have perl substitute the
scalar with the data in the scalar and have that data interpreted
correctly. Here's some code to illustrate:
#!/usr/bin/perl
my $x = q/-values => {K1 => V1, K2 => V2}/;
mytestsub($x);
exit;
Now the above works, but not the way I hoped. It sees a simple scalar
sent to the subroutine. What I'm shooting for is this:
#!/usr/bin/perl
mytestsub(-values => {K1 => V1, K2 => V2, ...});
exit;
The snippet above the subroutine would see an array that contains a
scalar and a hash.
Has anyone had any success in doing this? I believe I can get type of
thing under tcl but that's not an option.
I can do this a couple other ways but I was hoping for this as it would
save me lots of pain
Thanks in advance for any tips.
Rusty
My problem is I need to call a subroutine but the number of args can be
many and vary from call to call. What I'm trying to do is parse a
template and capture the data from the template into a scalar and then
call the subroutine with the scalar value and have perl substitute the
scalar with the data in the scalar and have that data interpreted
correctly. Here's some code to illustrate:
#!/usr/bin/perl
my $x = q/-values => {K1 => V1, K2 => V2}/;
mytestsub($x);
exit;
Now the above works, but not the way I hoped. It sees a simple scalar
sent to the subroutine. What I'm shooting for is this:
#!/usr/bin/perl
mytestsub(-values => {K1 => V1, K2 => V2, ...});
exit;
The snippet above the subroutine would see an array that contains a
scalar and a hash.
Has anyone had any success in doing this? I believe I can get type of
thing under tcl but that's not an option.
I can do this a couple other ways but I was hoping for this as it would
save me lots of pain
Thanks in advance for any tips.
Rusty