It's the first element of the array, try print $state_name[0]
In reply to Re^5: how to print out windows service status by poj in thread how to print out windows service status by ytjPerl