ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sub:
sub SumSub{
# Make Passed Prams Available To SumSub
my ($b,%c,$d) = (@_);
The above is not working. I never receive "$d" in SumSub. Unfortunately I can not "$c = \%c;" because I can not go and change the existing SumSub calls to $c (to many).
Is there any way I can get $d into SumSub even when passing a Hash before it?
Last edited by benpedersen; 02-04-2005 at 01:33 PM.
I cant send $c because in the other 500 locations that SumSub is called it already uses %c. If I would have written the code I would have referenced the Hash passing $c. But I have to use what is already there.
david_ross,
unfortunately I can not change how sumsub is called. I can not make it $c because in the 500 places the subsub is called it passes %c. I can only make the change from the inside of sumsub.
sasho,
I do receive $d using what you suggested, however when I use
$d = $_[scalar(@_)-1]; or $d = $_[2];
I no longer receive $b nor %c. I don't know why.
Thank you both. If you can think of anything, let me know.
Last edited by benpedersen; 02-04-2005 at 01:32 PM.
It's not quite clear how this sub is already being called, but you could use pop/shift as defined here: http://search.cpan.org/~nwclark/perl...erl_Functions,
the only problem is knowing when to do this and when not, if the current 500 calls do not pass the last param value ...
Possibly check if scalar(@_) is odd or even...
sasho, I work in a LARGE global company that requires a large amount of paperwork for each program changed(even if it is a minor change) that is why I don't change %c to $c.
Making $d global would work but I didn't want to do that. I have decided to just pass $d within %c (a little better than making $d global).
Sub:
sub SumSub{
# Make Passed Prams Available
my ($b,%c) = (@_);
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.