The routine Progreturns a list of scalars. The shiftfunction only works with an array. Arrays and lists are not the same thing. Arrays have storage, but no lists.
If you want the first list item returned Prog, do the following:
sub Prog {
return ( 'this', 'that' );
}
my $var = (Prog())[0];
print "$var\n";
I replaced the helper call with Prog()instead &Prog, because the latter is clearly an old-fashioned style.
, :
my ($var) = Prog();
, :
my ($var, $ignored_var) = Prog();
$ignored_var. , , , :
my ($var, undef) = Prog();