"Dillon, John" wrote: > According to > http://vipe.technion.ac.il/~shlomif/lecture/Perl/Newbies/lecture2/argv.html > the following program will do ...whatever (make a backup of files) and it > takes the file specified at the command line. I guessed from this that one > has a .pl file with the following script, execute it at c: by typing its > name and then the program stops and asks you what file you want to specify. > But this does not happen.
Why should it? What do you see in this code that would ask a question? > So how do you get the filename into the script? If you want an interactive program YOU have to do some work. Print the prompt, then take standard input from <STDIN>. print "Please enter filename to be copied\n"; my $filename = <STDIN>; The program will then wait until the user hits the Enter key. Whatever they have entered on the command line becomes the value of $filename. > > > use strict; > > my $filename = $ARGV[0]; > > open I, "<".$filename; > open O, ">".$filename.".bak"; > print O join("",<I>); > close(I); > close(O); > Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]