Hi Guys
Below is a small chunk of code which hopefully should give me a list like the following.
1 <username1>
2 <username2>
What I would like to be able to do is select 1 or 2 in STDIN and assign that number to the user name listed in the array.
Once the correct user is selected It changes directory to that users home directory continues.
I get the following error
Use of uninitialized value in concatenation (.) or string at testenv line 31, <S
TDIN> line 1.
foreach my $file (@ulist) {eval {
print "\n";
$n++;
print $n;
print " $file\n";
}}
print " Please select which user you would like to...\n";
my $user = <STDIN>;
chomp $user;
$user = $file;
chdir("$hdir/$user") || die "Cant Change to directory $hdir/$user: $!\
+n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.