The all_equal_ints() sub is being passed a list of 5 values. Inside the sub those values are accessed via the @_ array. The shift function takes (removes) the first value in the @_ array and assigns that value to the lexical var $first.

return 0 unless says to exit the sub and return 0 to the calling block if the next part of the statement is/returns false. $first == $_; is comparing the value in $first to the value is $_ to see if they are numerically equal. If they are not equal, false is returned to the earlier portion of the statement which causes the return 0 to be executed. If they are equal, it does nothing and moves on to the next iteration of the for loop.

I would normally write that return statement like this, which might be easier for you to understand.