in reply to How to Fetch Gmail

@labels is an array. $labels[0] prints the first element of that array. If that label is empty or an empty string, your program prints nothing.

Also, as usual,

use warnings
is a great help, as it will tell you if you are trying to print something undefined.