Sam_07 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use warnings; use CGI; #use File::Copy; my($buffer) = ""; my($firstChoice) = ""; my($secondChoice) = ""; my(@values) = ""; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); (@values) = split(/&/, $buffer); $firstChoice = $values[0]; $secondChoice = $values[1]; ($NULL, $firstChoice) = split(/=/, $firstChoice); ($NULL, $secondChoice) = split(/=/, $secondChoice); #print "Content-type: text/plain\n\n"; #print "$firstChoice\n"; #print "$secondChoice"; my($dynamic) = "$firstChoice$secondChoice.html"; open (FH, "+>" . $dynamic); print FH "<html>\n"; print FH " <head>\n"; print FH " <title>$firstChoice and $secondChoice</title>\n"; print FH " </head>\n"; print FH " <body>\n"; print FH " You chose $firstChoice and $secondChoice\n"; print FH " </body>\n"; print FH "</html>\n"; close (FH); #These are all of the ways that I have tried to move the file and fail +ed: #1: #rename "$dynamic", "dynamics/$dynamic"; #2: #system("mv $dynamic dynamics/"); #3: #my($original_file) = "$dynamic"; #my($new_file) = "dynamics/$dynamic"; #move($original_file, $new_file); print "Location: dynamics/$dynamic\n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moving a .html file
by GrandFather (Saint) on Feb 25, 2012 at 03:58 UTC | |
|
Re: Moving a .html file
by oko1 (Deacon) on Feb 25, 2012 at 03:16 UTC | |
|
Re: Moving a .html file
by bitingduck (Deacon) on Feb 25, 2012 at 03:31 UTC | |
|
Re: Moving a .html file
by Sam_07 (Initiate) on Feb 25, 2012 at 05:48 UTC | |
by GrandFather (Saint) on Feb 25, 2012 at 06:14 UTC | |
by Sam_07 (Initiate) on Feb 25, 2012 at 08:54 UTC |