in reply to Re: searching several files for a string at one time
in thread searching several files for a string at one time

but how do I make it so the users can select the directory when the programme is ran?
One way is to pass it in on the command line (see shift):
use strict; use warnings; my $directory = shift; print "dir=$directory\n"; # just for debug

Run your program as:

$ ./838783.pl /foo/bar dir=/foo/bar

Replies are listed 'Best First'.
Re^3: searching several files for a string at one time
by daggy (Novice) on May 06, 2010 at 19:52 UTC
    I tried the first paragraph of code
    use strict; use warnings; my $directory = shift; print "dir=$directory\n"; # just for debug
    I got this error use of uninitilised value $directory in concatenation (.)or string at.......... sayingline 6 fault in code, but dont know why... bah this stuff confuses me Do I add the code you posted to the code I already have or is it stand alone? If so, what did you mean by run my file as the second bit of code?