On Sat, Oct 24, 2009 at 11:25 PM, Shachar Shemesh <shac...@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/

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to