@_ is an alias for the arguments sent, and the foreach loop makes $element an alias for each element of @_ in turn, so this works out and is reasonably clearer.@array = (10,20); Double(@array); print "@array"; sub Double { foreach my $element (@_) { $element *=2; } }
In reply to Re: use of typeglob aliases
by digital_carver
in thread use of typeglob aliases
by fionbarr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |