Maybe:
@array = @{$obj->something()};
In the first example, it looks like it $obj->something()returns a reference to an array, you need to dereference it.
In addition, you must really use strict;and use warnings;, and declare your variables as
my @array = @{$obj->something()};
foreach my $val (@array) {
}
(, , ), script.