my @list = (@lines); foreach (@lines) { my @fields = split /,/; if ( $fields[2] eq '1' || $fields[2] eq '0' ) { @arr1 = do {"@fields[4]\n"}; my @out = uniq @arr1; print "this is @out"; } } #### this is out XY-CAR-SHOP1_RADIATOR-PARTS this is out XY-CAR-SHOP1_RADIATOR-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS this is out QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS #### my @list = (@lines); foreach (@lines) { my @fields = split /,/; if ( $fields[2] eq '1' || $fields[2] eq '0' ) { @arr1 = do {"@fields[4]\n"}; } } my @out = uniq @arr1; print "this is @out"; #### QZ-CAR-STORE2-PRACTICAL_SNOWTIRE-02-X3-PARTS #### XY-CAR-SHOP1_RADIATOR-PARTS