in reply to trying to use join in a loop

An easy (but not the best) way to fix the error is to use a concatenation instead of join:

# $newfirst .= join(" ",(ucfirst $nfirst[$i]) ); $newfirst .= " " . ucfirst $nfirst[$i];

There seems to be some confusion between arrays and scalars in your code. $newfirst is a scalar, so initializing it with () doesn't do anything. join takes a separator and a list as arguments and puts the separator between adjacent elements of the list, but you feed it one element at a time so there never are adjacent elements.

One more idiomatic solution would be to use map instead of looping through the list of names (in fact, there's not many cases where you need to write C-style loops in Perl), like this:

use strict; #except to test my code #do the fancy stuff here for multiple Christian names #count how many firstnames #first would have been read in from a text file, but is explicit here my $first = "billy bob allan"; my @nfirst = (); @nfirst = split (/\s/,$first); print "name $first has ".(scalar(@nfirst))." names\n"; my @newfirst = map { ucfirst } @nfirst; print "new first name is @newfirst\n";

You could also do it in one go with a regex, which for the moment I leave as an exercise to the reader :)