I was wondering whether anyone can explain the difference between the $name
and ($name)
.
For example:
my @objects = ('specs','books','apple');
my ($fruit) = grep { $_ eq 'apple'} @objects;
This gives the result for $fruit = 'apple'
. However, if the second statement is modified as:
$fruit = grep { $_ eq 'apple'} @objects;
The value for the fruit is evaluated to 1
. Is this related/specific to grep
?