Examples of using "it":
map { (1/$_)+1 } 1..100; grep { $_ eq 'something' } @list;
for (big_long_calculation) { $_->foo; }
if (my $it = big_long_calculation) { $it->foo; }
say for @list;
say $_ for @list;
Examples of using "it":
You can also replicate the if and big_long_calculation using "for": But if u prefer to stick with "if" then you can do: And remember in a lot of cases using "it" isn't mandatory: is same as: