in reply to splitting array in filehandling

fish vs fishing... :-/
use strict; while (<DATA>) { my ($host,$proto) = split; my @proto = split /,/,$proto; my %c; for my $pr (@proto) { my ($p)= $pr =~ /(\w+)/; $c{$p}++; } my %num; print "$host = \$hostname"; for my $pr (@proto) { my ($p)= $pr =~ /(\w+)/; if ($c{$p} == 1) { print " $pr = \$$p"; } else { print " $pr = \$$p",++$num{$p}; } } print "\n"; } __DATA__ gs01.pri1.casino.sbo dns:192.168.101.21,icmp,http:302,https:200,tcp:80 +,tcp:443,wget gs02.pri1.casino.sbo dns:192.168.101.22,icmp,http:302,https:200,tcp:80 +,wget
update: delete useless and overcomplicated code