in reply to TK "textvariable" not updating with @var but ok with $var

Hi,

Yes it is possible to explain the behavior

This is forgetting all the textvariables , its making the textvariables forget the array, its disconnecting the array values from the textvariables  @var1 = change_var1_2(@var1);

If you do that then the textvariables are lost, the references no longer point to the array

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd / ; my @f = 0; my $fo = \$f[0]; dd\@f; $$fo++; ## @f is updated dd\@f; @f=(); ## $fo no longer points to @f, $fo and @f disconnected $$fo++; dd\@f; __END__ [0] [1] []

Also names, like like variable names, for example @var1/$var1[] ; if you read that out loud it is array variable variable one the @ part tells us its a perl variable of the array variety (array for short), so "var" shouldn't be part of the name

Similarly 1 shouldn't be part of the name, but thats what you have left @1

I would call it @chg or whatever "chg" stands for, maybe @change, something with meaning

Replies are listed 'Best First'.
Re^2: TK "textvariable" not updating with @var but ok with $var
by mark4 (Acolyte) on Jan 27, 2017 at 00:30 UTC
    Thank you! I will try to leave that line out and debug more. (I don't 'completely' understand yet, But I get the basic of what you are saying.) Again Thanks -Mark
      I also see that my sobroutine change_var1_1 has the line  @var1 = change_var1_2(@var1); in it. As I see from debug, this is also disconnecting the array. Perhaps for my (better) understanding you could sugest a different was to assign the @var1 array without having it get disconnected?
        This worked.
        sub change_var1_1 { my $i; my @foo = change_var1_2(@var1); for ($i = 1; $i <= 81; $i++) { $var1[$i] = $foo[$i]; } $status = "change_var1_1 called $var1[3], $var1[5]"; }
        As we know this isn't working...
        sub change_var1_1 { @var1 = change_var1_2(@var1); $status = "change_var1_1 called $var1[3], $var1[5]"; }
        Is there a better way? Should I just not be using arrays in the textvariables? i.e.  -textvariable => \$puz[25]