hi!
Die Elemente von @lines werden nach und nach $line zugewiesen. Änderungen an $line ändern die
Elemente im Array !!!
bist du dir da sicher? Kannst du es beweisen? ;)
perldoc perlsyn:
=== cut ===
Foreach Loops
[...]
The foreach' keyword is actually a synonym for the
for' keyword, so
you can use foreach' for readability or
for' for brevity. (Or because
the Bourne shell is more familiar to you than *csh*, so writing for' comes more naturally.) If VAR is omitted,
$_' is set to each value. If
any element of LIST is an lvalue, you can modify it by modifying VAR
inside the loop. That's because the `foreach' loop index variable is an
implicit alias for each item in the list that you're looping over.
=== cut ===
Beweis:
=== cut ===
#!/usr/bin/perl
@array = (1, 2, 3);
print @array;
for (@array)
{
$_++;
}
print @array;
=== cut ===
bye, Frank!