Hi, monks. I wrote the below code to test. Why the variable $n was undef? I wonder what's the difference between a foreach construct and an if construct in this case. Thanks for any help.
#!/bin/env perl
use strict;
use warnings;
my $n = $_ foreach (1 .. 2);
warn "\$n = $n";
my $m = 1 if (1);
warn "\$m = $m";