# return something that is going to come from ... # ... an unnamed subroutine (unnamed ... # ... because there's nothing between "sub" and "{" return sub { # r is a random number >= 0 < 1 my $r = rand(); # an implicit if statement: # if, when going through every value of odds from lowest ... # ... to highest, r is less than that value of odds, this ... # ... code will go on to the "and" statement, and otherwise... # ... it will go on to the next value in @odds # if it gets to the "and" statement, it will return the ... # ... corresponding value for @vals to the subroutine ... # ... call, which will, in turn, return that to the main ... # body of the script $r < $odds[ $_ ] and return $vals[ $_ ] for 0 .. $#odds; };