#!/usr/bin/env perl use strict; use warnings; use threads; use threads::shared; use Data::Dumper; my @state = &share([]); meow(); print Dumper \@state; sub meow { my @p = qw{grey striped purrr cutest_kitty meowing_kitty the_lord_of_the_cats}; my @k = qw{smart_kitty striped_sweety purrr meowing_poes social_kitty the_lord_of_the_poezen}; for (0 .. 5) { push @{$state[0]}, $p[$_]; push @{$state[1]}, $k[$_]; } return; } #### $ pm_thr_share_array.pl $VAR1 = [ [ 'grey', 'striped', 'purrr', 'cutest_kitty', 'meowing_kitty', 'the_lord_of_the_cats' ], [ 'smart_kitty', 'striped_sweety', 'purrr', 'meowing_poes', 'social_kitty', 'the_lord_of_the_poezen' ] ];