I've been beating my head against the wall with this for a couple of days now and still can't figure it out.
I'm writing a TK program that returns a scrollable list based on the user's search parameters and then displays the data in Tk Entry fields on the screen. All well and good, but since my data is set up as a HoAoH, I'm using a ternary expression in the Bind to determine what data I'm going to display.
Here's my code:
$results->bind('<ButtonRelease-1>'=> sub{ $list = $results->curselection; $key eq "year" ? &show($bros->{$data}->[$list]) : $index = 0; while($bros->{$ydx[$list]}->[$index]->{$key} !~ /$data/ +i){ $index++; } $yr = $ydx[$list]; &show($bros->{$ydx[$list]}->[$index]); });
The thing I can't figure out is when my selection key is not "year" the routine works fine. However when it is year, I keep getting a "Tk::Error: Can't modify non-lvalue subroutine call".
I don't understand why this is popping up. I know the values of $data and $list are populated. $data is the year I'm searching on, and $list is the array index from the scrollable list. I've even tried placing static values in that part of the code rather than variables and I still get the same error. Data::Dumper shows that the data is actually in the structure, and the data I want to display, so I'm totally confused. Even more so since the same subroutine call works when my key is anything but "year".
If there is a problem with how I'm sending the data to the subroutine, I can't see it. The subroutine &show is simply taking the data it gets passed, and displaying it in the entry fields.
Any help to clear this up would be greatly appreciated!
In reply to Need help with binding event in Tk by Popcorn Dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |