while () { s/,//; @Fields = split ' '; $Lable = $Fields[-2]; #sic -- should be "Label" $Slot = $Fields[2]; # You never set $Type, so the next line will get # a "use of undefined value" warning. push @List, "$Slot $Type $Lable"; } # You also never write anything to OUT