in reply to Creating a Menu List
Since you have no numbers next to the lines, we have to guess. I suspect
$user = $file;
to be the culprit, since you just clobber the $user variable whose value you just read from STDIN and carefully chomped, with an undefined value: the my $file above is defined only for the foreach context. use strict would catch that. And so,
chdir("$hdir/$user") || die "Cant Change to directory $hdir/$user: $!\ +n";
causes the the warning to be thrown. Where's $hdir defined?
Anyways, that should be
my $number = <STDIN>; chomp $number; die "Invalid selection\n" if $number =~ /\D/; die "Number given too big\n" if $number > scalar(@ulist); my $user = $ulist[$number]; chdir("$hdir/$user") || die "Cant Change to directory $hdir/$user: $!\ +n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating a Menu List
by muizelaar (Sexton) on Sep 16, 2008 at 14:07 UTC | |
by lostjimmy (Chaplain) on Sep 16, 2008 at 16:03 UTC | |
by muizelaar (Sexton) on Sep 17, 2008 at 12:17 UTC |