in reply to "shift" not working as expected
return if not $data; returns from sub sendX when $data is 0 (a false value).
See also: Truth and Falsehood, and Basic debugging checklist, especially point 2.