#!/usr/bin/perl -w use strict; ( my $name, my $passwd, my $uid, my $gid, my $quota, my $comment, my $gcos, my $dir, my $shell, my $expire ) = getpwnam('user'); # Insert '(undef)' if variable is undefined. foreach my $x ( \$name, \$passwd, \$uid, \$gid, \$quota, \$comment, \$gcos, \$dir, \$shell, \$expire ) { ${$x} = '(undef)' unless ( defined( ${$x} ) ); } printf <