use Data::Dumper; my @list = (1..10); my $d = Data::Dumper->new(\@list, qw(*list2)); my $str = $d->Dump(); my @list2; eval $str; print join '-', @list; print join '-', @list2;