in reply to understanding next

It's not next that is tripping you up, but the comma operator. The fix that is closest to your original code is:

use strict; use warnings; $! = 1; my @l_test = (1,2,3,4,5,6,7); foreach my $l_rec (@l_test) { (print '.'), next if ( 4 == $l_rec); print $l_rec; }

but:

foreach my $l_rec (@l_test) { if ( 4 == $l_rec) { print '.'; next; }

would make your intent clearer.

Update: see Comma Operator


Perl is environmentally friendly - it saves trees