foreach my $test (@$ref) { my $test2 = substr($test, 0, 2); }