I found no way on how to push data to the @chords and @notes arrays of a record with that structure. I tried f.i.my @scales; struct( Scale => { name => '$', offset => '$', foo => '$', index => '$', chords => '@', notes => '@' });
which runs without an issue, but leaves the array empty. If I use Dumper to show the data I get likemy $sref = $scales[$scale]->chords; push @{$sref}, $found_chord . ';' . $c[1];
which looks like there are just empty arrays in that struct. How is the correct push syntax here?... bless( { 'Scale::index' => '8', 'Scale::notes' => [], 'Scale::name' => 'Major Bebop Eb', 'Scale::chords' => [], 'Scale::foo' => 'E61100', 'Scale::offset' => undef }, 'Scale' ), bless( { 'Scale::offset' => undef, 'Scale::foo' => 'E61100', 'Scale::chords' => [], 'Scale::name' => 'Major Bebop F', 'Scale::notes' => [], 'Scale::index' => '9' }, 'Scale' ), ...
In reply to Push to array as part of Struct by Miq19
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |