that one guy has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w sub namedir { print "Enter the directory path you want to search: "; $dir = <STDIN>; } sub dirme { if (! $dir){ &namedir; } print "\n\nFiles in $dir\n"; opendir(BIN, $dir) or die "Can't open $dir: $!"; while( defined ($file = readdir BIN) ) { # list files print "$file\n"; } closedir(BIN); } &dirme;
2006-04-06 Retitled by g0n, as per Monastery guidelines
Original title: '...a little help, please'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to read from STDIN?
by japhy (Canon) on Apr 05, 2006 at 19:20 UTC | |
|
Re: How to read from STDIN?
by davidrw (Prior) on Apr 05, 2006 at 21:08 UTC | |
|
Re: How to read from STDIN?
by roboticus (Chancellor) on Apr 06, 2006 at 02:20 UTC |