While i can't seem to come up with a simple example to demonstrate it, my feeling is that this line:
@SLIDERVALUES = (5, 10, 15, 20); results in the 5,10,15,20 being stored in a different place (address).. i.e. that you've pulled the rug out from uder the
\$SLIDERVALUES[$i] pointers.. That answer is consistent with direct changes like
$SLIDERVALUES[1] = 14; working, but i realize it's still kind of hand-waving... Hopefully another monk can clarify from here..
Here's some code that shows in short the funniest coding on:
my @x = ( 1, 2, 3, 4);
my $v = \$x[2];
warn $v;
warn "v = " . $$v;
warn " " . $_ . " " . \$_ for @x;
@x = ( 5, 12, 13, 14);
warn $v;
warn "v = " . $$v;
warn " " . $_ . " " . \$_ for @x;
__END__
SCALAR(0x80fbc5c) at /tmp/arr line 6.
v = 3 at /tmp/arr line 7.
1 SCALAR(0x80fbb0c) at /tmp/arr line 8.
2 SCALAR(0x80fbc14) at /tmp/arr line 8.
3 SCALAR(0x80fbc5c) at /tmp/arr line 8.
4 SCALAR(0x8120634) at /tmp/arr line 8.
SCALAR(0x80fbc5c) at /tmp/arr line 11.
v = 3 at /tmp/arr line 12.
5 SCALAR(0x80fbb0c) at /tmp/arr line 13.
12 SCALAR(0x80fbc14) at /tmp/arr line 13.
13 SCALAR(0x8120634) at /tmp/arr line 13.
14 SCALAR(0x810531c) at /tmp/arr line 13.
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.