|Do you know where your variables are?|
Re: STDIN help for a new Perl coderby linuxer (Curate)
|on Jul 15, 2009 at 16:59 UTC||Need Help??|
Welcome here and to Perl.
If you read User input like that, you must know, that the linebreak will also be stored in your variable. So you must remove it; see chomp for details.
chomp( my $dir = <STDIN> );
Each statement should be completed with a ';', your chdir misses one.
You should check if chdir was successful and do something if it wasn't ($! contains the system's error message).
chdir( $dir ) or die "$dir: $!\n";
If you already changed into $dir, you must not specify it again in the glob pattern.
As you are using strict, you need to declare each new variable. You did it right with $dir, but not with @files.