in reply to Why do I get uninitialized value in substitution (s///) in my array?

It would seem that a lot of this script is copied and pasted. From my own experiences, this usually ends up taking far more time debugging, than starting from scratch...

Without seeing more of your script and data, (please reply with further info), I suspect that you might simply need to chomp the $_ assigned from @nup.


Eg.

open (USERS, ">", $users) or die "Cannot open $users: $!"; foreach (@nup){ # print "$genpass[0]\n"; <==this works s/xyz456/$genpass[0]/; <==this gets uninitialized #print USERS; $a = shift(@genpass); }
becomes

open (USERS, ">", $users) or die "Cannot open $users: $!"; foreach (@nup){ chomp; print "$genpass[0]\n"; s/xyz456/$genpass[0]/; #print USERS; $a = shift(@genpass); }