- or download this
{
my $counter = 0;
sub inc_counter { $counter++ }; # $counter is visible here
sub get_counter { $counter }; # and here
}
- or download this
$/ = "\n";
my $line = <STDIN>; # <> operator reads just one line
...
}
$line = <STDIN>; # reads just one line again, since $/ returns
+to "\n"
- or download this
for (0 .. 100) {
next unless $_ % 2; # skip multiples of 2
next unless $_ % 5; # skip multiples of 5
print "$_\n";
}