could I use getpwent to parse the output of $user?
No, and if all you want are the usernames you need nothing so fancy anwyay.
#!/usr/bin/env perl
use strict;
use warnings;
my $user = <<EOT;
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
EOT
chomp ($user); # as you have done
$user =~ s/:.*$//mg;
$user =~ s/\n/,/g;
print "hostname,$user\n";
... and don't start doing master_opts => [-o => "StrictHostKeyChecking no" ] without very good reason.