- or download this
$ perl -Mstrict -Mwarnings -E 'my $foo; say ++$foo'
1
$ perl -Mstrict -Mwarnings -E 'my $foo; say $foo + 1'
Use of uninitialized value $foo in addition (+) at -e line 1.
1
- or download this
foreach my $employee (@employees) {
if ( $employee->salary < $threshold ) {
increase_salary( $employee, 3_000 );
}
}
- or download this
if ( defined $threshold ) {
foreach my $employee (@employees) {
...
}
}
}
- or download this
use Unknown::Variables;
...
my @array = ( 1, 2, 3, $value, 4, 5 );
my @less = grep { $_ < 4 } @array; # assigns (1,2,3)
my @greater = grep { $_ > 3 } @array; # assigns (4,5)
- or download this
foreach my $employee (@employees) {
if ( $employee->salary < $threshold ) {
increase_salary( $employee, 3_000 );
}
}