Hi, Well I got to test check a dir. If I select /etc or /home/user it works. But if I leave a blank, just only ENTER I got the below error. "/home/user exist and is rwx". What I'm missing in my script?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - #!/usr/bin/perl use diagnostics; use strict; print "Please select your directory\n"; chomp (my $dirname=<STDIN>); my $UPATH=`pwd`; print "\$UPATH = $UPATH\n"; if ($dirname =~ /^\s*$/){ $dirname="$UPATH"; print "\$dirname=$dirname\n"; } print "\$dirname=$dirname\n"; opendir DH, $dirname or die "Cannot open $dirname: $!"; #line number 31 while (my $file = readdir DH) { $file="$dirname/$file"; next if $file =~ /^\./; print "One file is $file\n"; } closedir DH; - - - - - - - - - - - - - - - - - - - - - - - - - - - - Then running the script: - - - - - - - - - - - - - - - - - - - - - - - - - - - - ./script Please select your directory <empty> ENTER $UPATH = /home/user $dirname=/home/user Uncaught exception from user code: Cannot open /home/user : No such file or directory at ./script line 31, <STDIN> line 1. at ./script line 31 - - - - - - - - - - - - - - - - - - - - - - - - - - - - Thank you. -- Gianluca Tognin Systems Engineer Ascom Italia S.p.A. Via Magellano,1 41100 Modena - Italy Office (pabx): +(39)059 895011 Office: +(39)059 895059 FAX: +(39)059 895010 mobile 335 7191683 WEB: www.ascom.it -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/