in reply to Array issue

use strict; use warnings; my @listOfPass; my ($section,%passwds); while(<DATA>) { chomp; if (/^\[(.*?)\]$/) { $section = $1; next; } elsif ($section eq 'PASSWORDS') { my ($mkt,$pass) = split; push @listOfPass, $pass; } }#end while loop print join(',', @listOfPass); __DATA__ [PASSWORDS] GUY ddd GIRL dfd33 BOY df341
UPDATE I just reread the OP. The passwords need to be in the order that they were received. I modified this code to use the push function like Ovid suggested. I got too trigger happy with my caffeine induced post :)