Perl question: array member of referenced hash
Gabor Szabo
szabgab at gmail.com
Sat Oct 24 23:33:55 IST 2009
On Sat, Oct 24, 2009 at 11:25 PM, Shachar Shemesh <shachar at shemesh.biz> wrote:
> Let me try to summarize what I understood from your excellent explanation:
if that works for you :-)
>
> All that is left is understanding why the round braces around the whole
> expression.
Oh, the syntax of foreach has those parentheses
foreach my $iterator (things to iterate over) {
}
Where the things to iterate over can be a simple list of values, an array or
anything that returns a list of values which of course can be any expression.
foreach my $iterator (1,2,3,4,5) {
}
or for the lazy ones
foreach my $iterator (1..5) {
}
or for the really lazy ones:
for my $iterator (1..5) {
}
or
foreach my $iterator (@names) {
}
foreach my $iterator (@$ref) {
}
foreach my $iterator (function_that_returns_thingies()) {
}
Gabor
http://szabgab.com/blog.html
Perl Training Israel http://www.pti.co.il/
More information about the Linux-il
mailing list