How do I return multiple values from a Perl function call?
Sample code
my ($value1, $value2, $value3) = getValues(@parts)
sub getValues
{
foreach(@_)
{
$_ =~ m{/test1_name (.*) test2_name (.*) test3_name (.*)/};
$test1_value = $1;
$test2_value = $2;
$test3_value = $3;
}
}
This code is not working.
@partsis being declared?@parts. If you would like to do this for all of the values in this array, then you'll have to use a for loop.