prod is the environment I want to capture in a perl script. I want the script to run on qa and it should be environment independent.So if I am running the script on app.qa.cbo.im.foobar.com I want to capture qa out of that hostname and use that later on in my perl script.
Generally in a shell script I do this -
hostname |awk -F"." '{print $2}'
What would be the perl equivalent of this so that I can put that in a variable.
I did use a2p but got some very verbose results which I did not understand. I want something one liner which I can feed into a variable.