I am using unpack to unpack an element that consists of a 32 byte hex string plus an optional unsigned integer. If the integer exists, I want to join the 2 with an underscore.
join("_", unpack("H32V*", $string));
but it always performs the join even if there is no second element. Adding an intermediate assignment, made it work:
my @temp = unpack("H32V*", $string);
But that seems kludgy and I would like to avoid it. So, is there any way to properly cast/assign the result of unpack so that an undefined second element is ignored by join without using an intermediate variable?