Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
thank u!
#!/usr/bin/env perl use strict; use warnings; print "enter user name to add\n"; my (@users,@exusers,%adds,$u); chomp (@users = map {lc} <>); print "enter user names to mirror\n"; chomp (@exusers = map {lc} <>); foreach $u (@users) { $adds{$u} = qx(ls /home/$_/.bash_profile) for @exusers; } use Data::Dumper; print Dumper \%adds; ##################### $ perl foo enter user name to add kate dan enter user names to mirror doug.smith $VAR1 = { 'kate' => '/home/doug.smith/.bash_profile ', 'dan' => '/home/doug.smith/.bash_profile ' }; $ perl foo enter user name to add kate dan enter user names to mirror doug.smith test $VAR1 = { 'kate' => '/home/test/.bash_profile ', 'dan' => '/home/test/.bash_profile ' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: user input for hash
by ikegami (Patriarch) on May 15, 2010 at 21:17 UTC | |
|
Re: user input for hash
by toolic (Bishop) on May 15, 2010 at 21:10 UTC |