The following code produces the correct array output but the second print occurs after the first print! I don't see why....
#!/usr/bin/perl -w use strict; sub sub_myarray_test; sub sub_myarray_test { my @my_array = ("one", "two", "three"); my @my_array2 = ("four", "five", "six"); print "\n\tIn subroutine \@my_array = @my_array\n"; print "\tIn subroutine \@my_array2 = @my_array2\n\n"; return \(@my_array, @my_array2); } my ($test_array, $test_array2) = sub_myarray_test; print "test_array: @$test_array " . #{${@{$test_array}}} . "\n"; print "test_array2: @$test_array2\n"; exit;
bash-2.05b# test_array
In subroutine @my_array = one two three
In subroutine @my_array2 = four five six
test_array2: four five six
test_array: one two three 1bash-2.05b#
VERSION: Perl 5.8.0 r12 on Gentoo Linux 1.4 (custom)
Any clues? In reply to printing referenced arrays weirdness
by jfroebe
Thanks
jason
THANKS! That was pretty dumb... and simple... grrr ;-)
For:
Use:
& & < < > > [ [ ] ]