#!/usr/bin/perl use warnings; use strict; use Text::ParseWords; my (@users, @fields); if (open PASSWD,"/etc/passwd") { @users = ; chomp @users; # remove linefeeds @fields = quotewords(':', 0, @users); close PASSWD; } print "@fields";