(My termemology may be off here, I'm a hardware guy :))
I see, You can send the pointer to the array to the subroutine so that the subroutine knows which array to modify. This works for me !!
Also, my appologies for caling it @var1. It actually highlights my 'wrong' thinking that you can treat an array just like a variable. (and this may be what you were saying, i.e. pointing out my 'wrong' thinking.) This code was actually a stripped down example (believe it or not) and as I replaced the original variables and arrays, I just picked @var1 and $var2.
Thanks for your help, I understand now.
Also, for my purpouses, This works just as well: (Note, I global replaced 'var1' with 'fee')
my @some_arry_to_modify_by_the_sub;
my @some_other_arry_to_modify_by_the_sub_with_the_same_structure_but_
+different_data;
#some call like ---> change_fee_1(@some_arry_to_modify_by_the_sub);
#or ---> change_fee_2(@some_arry_to_modify_by_the_sub)
sub change_fee_1 {
change_fee_2(@_);
$status = "change_fee_1 called $_[3], $_[5]";
}
sub change_fee_2 {
$_[3] = 6;
$status = "change_fee_2 called $_[3]";
}
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.