http://qs321.pair.com?node_id=644004

cidaris has asked for the wisdom of the Perl Monks concerning the following question:

I use an application called Easy-IP to keep track of IP utilization. Underneath lies a Firebird database, which I've extracted to CSV. The header line lists all the columns, but I wanted to know the array index for processing. Short of counting commas, I came up with:
head -1 ./current.csv |perl -ane '$i = 0; s/\,/" ".$i++."\n"/eg; print +;'
The header line looks like so:
SUBNET_ID,AUTONOMOUS_NETWORK_ID,PARENT_ID,TREE_PATH,SUBNET,CIDR_MASK,I +P_VERSION,LOW_ADDRESS,HIGH_ADDRESS,BROADCAST_ADDRESS,SHORT_SUBNET,ASS +IGNED_ADDRESSES,CHILD_SUBNET_COUNT,COMMENT,SYSTEM_FLAG1,REPLICATED_FR +OM,CREATED,UPDATED,LOCATION,USAGE,NETWORK_NAME,IP_NETWORK,IP_NETWORK_ +BLOCK,ORGANIZATION,ADMIN_CONTACT,TECH_CONTACT,ORG_NAME,STREET_ADDRESS +,CITY,STATE,POSTAL_CODE,COUNTRY_CODE,PRIMARY_SERVER,SECONDARY_SERVER

My output, abbreviated:
SUBNET_ID 0 AUTONOMOUS_NETWORK_ID 1 PARENT_ID 2 TREE_PATH 3 SUBNET 4 ...
I bet the brains at PM can do better. Suggestions?