You are here:

Perl & CGI/Questions Answered by Expert Jason Silver

SubjectDate Asked
Perl10/13/2011
  Q: There is no strict data types in perl as in other high level languages like Java so wouldn't that ...
  A: I'm sorry I misunderstood the question the first time. I'm not certain this would be a problem if ...
CGI script installation error message7/27/2011
  Q: Greetings from South Africa and hope you can help me with my small installation problem. I recently ...
  A: I am not familiar with this script, but it looks like it is trying to write to a file and is not ...
cgi file-Perl language1/4/2011
  Q: I am writing a cgi in perl language. The whole program contains an html form that has radio buttons ...
  A: First, give your radio buttons a name, so that when they are selected, and the form is submitted to ...
Enabling support for CGI scripting on Mac OSX11/10/2010
  Q: I am following steps to do this outlined in 'Blog Design Solutions' I have typed a test file, named ...
  A: You may have made a mistake with your URL. 1. Is there a web server running on your machine? That's ...
What to use8/3/2010
  Q: I'm a programmer but I don't have must experience with web development. I would like to develop a ...
  A: If you want an interactive video game with sprites moving across the screen, etc., as opposed to a ...
GD::Graph and DBI5/6/2010
  Q: I have some questions regarding GD::Graph and DBI and hope you could aid and guide me along. I have ...
  A: It's hard to see anything outwardly wrong with this, but my suggestion is to put some print commands ...
Coverting values in PERL4/27/2010
  Q: I'm new in PERL and hope that you can help me. I'm new to PERL and have done a CGI script which ...
  A: Sorry, this means the variables weren't declared. Declare them before using like this: my ...
Coverting values in PERL4/27/2010
  Q: I'm new in PERL and hope that you can help me. I'm new to PERL and have done a CGI script which ...
  A: > I have a wireless sensor that is collecting data like > temp,light and sound. COOL! > ...
Coverting values in PERL4/26/2010
  Q: I'm new in PERL and hope that you can help me. I'm new to PERL and have done a CGI script which ...
  A: This is a bit complex if you don't understand Perl and DBI. I wish I knew more about your situation. ...
Can't find string terminator "END_HTML" anywhere before EOF11/23/2009
  Q: #!/usr/bin/perl -wT use strict; use CGI; use CGI::Carp qw ( fatalsToBrowser ); use ...
  A: I personally recommend swapping out the <<END_HTML tag with the qq tag, as follows: print qq~ ...
Perl script - combine arrays/create new array based on header11/20/2009
  Q: I attempted a few lines of Perl to format some data and have become stuck. I am am slowly learning ...
  A: Glad the code worked out of the box-- I didn't test it at all. The 'sort by value' is done by using ...
Perl script - combine arrays/create new array based on header11/19/2009
  Q: I attempted a few lines of Perl to format some data and have become stuck. I am am slowly learning ...
  A: Though not tested, I would do it this way since you said the file isn't very large: #!/usr/bin/perl ...
Run same perl script on Win and Unix'es9/7/2009
  Q: I'm writting a perl script for both Win and *nix environments. At this moment I have to code 2 ...
  A: the way I do this is to set variables at the top of the script which accomodate the differences. ...
How Do I pass a javascript variable to a Perl script?8/12/2009
  Q: I've tried a million things. Below is the latest. Any time I use value=dayofmonth in the input I get ...
  A: This is a Javascript question, not a Perl question. But it looks to me that you've got a typo or ...
php flush won't work in IE77/10/2009
  Q: My problem : I want the navigator to start displaying outputs even though the whole page is not ...
  A: This question is misdirected as this is a Perl forum. However, I do have experience in PHP, and can ...
perl in PHP5/8/2009
  Q: so I want to know if somehow I can use both of them at the same time? Actually I want to know if I ...
  A: Yes, it is possible to write a script that can take form input, and then do things on the server. ...
BNB form3/18/2009
  Q: I've been running a CGI form script made by bignosebird.com for several years without problems ...
  A: Things usually stop working because something changes somewhere-- I recommend giving your host a ...
forms and CGI2/10/2009
  Q: I am new to programming and am using dreamweaver. I can create a form, but I get lost on the cgi ...
  A: I suggest you download a form processing script -- either in PHP or Perl. For example, I give one ...
cgi script issue2/3/2009
  Q: I have created a form using a script that I got from Bignosebird.com, it is bnbform v4.0. I made ...
  A: Actually, I believe your tech support was mistaken. It WAS administratively denied, but not because ...
Sub routine1/22/2009
  Q: I have some numbers in @game=(10,2,13) for example and want to display for each number, a picture ...
  A: Try this instead: @game = (10,2,13); sub show { $what2show = $_[0]; $show="<img ...
Array, sort1/17/2009
  Q: I have a text file that contains lines like: name1/value1 name1/value2 name2/value3 name3/value4 etc ...
  A: This sounds suspiciously like a homework question, so I'll just give you some direction on how to ...
Calling subroutine (PERL CGI question)12/14/2008
  Q: Let me first tell you what my script is supposed to do; It's a page where users can view, edit and ...
  A: > 1. how can I get the value of $pagename to change from > 'home' to 'preview' after edit() runs? ...
Screen Scraping11/22/2008
  Q: I am looking at executin a task which needs Screen Scraping, I am familiar with Perl, however I am ...
  A: You want the module LWP, which is installed by default. Here's an example: my $url = ...
Web server10/2/2008
  Q: I have a static Ip Address, but I want to use my PC as a web server and using Perl/CGI as server ...
  A: This is a very long and complicated question to answer. It is best if you do some research with ...
LWP:Simple9/28/2008
  Q: Some days ago you replied to my question "How to send data to a remote server from a perl script ...
  A: From here: http://www.perl.com/pub/a/2002/08/20/perlandlwp.html?page=5 When you access an HTTPS ...
LWP:Simple9/27/2008
  Q: Some days ago you replied to my question "How to send data to a remote server from a perl script ...
  A: Yes, you may send query parameters as part of your URL string. Sending a GET request is the method ...
Perl sending data9/20/2008
  Q: Jason, Well here is the same question in short: How to send data to a remote server from a perl ...
  A: OK, little easier to approach. You need to have a script on your server that knows how to accept ...
File locking etc9/17/2008
  Q: On a server with a high traffic, what is the best way to be sure that 2 users won't update the same ...
  A: I'm glad this is working for you. Sometimes it does happen that the script doesn't get to call the ...
File locking etc9/16/2008
  Q: On a server with a high traffic, what is the best way to be sure that 2 users won't update the same ...
  A: The example you pasted uses flock, which is a server system of locking a file and isn't always ...
File locking etc9/16/2008
  Q: On a server with a high traffic, what is the best way to be sure that 2 users won't update the same ...
  A: Here's how I approach it logically: 1. User requests to open a file. 2. My program checks to see if ...
perl script run on local host8/27/2008
  Q: i wrote down simple perl script on notepad #!/usr/bin/perl print "Content-type: text/html "; ...
  A: You'll need to download and install a web server to see the page run in a browser. Then you will be ...
disabled perl script8/26/2008
  Q: I bought a perl database program and installed it with an incorrect uploadsdir path. I can edit the ...
  A: Without getting in and looking around it is nearly impossible to guess what is wrong. It sounds ...
Form processing8/14/2008
  Q: A probably stupid thing blocks me: I use a html form to send data: <form action="go.cgi" ...
  A: I think your rating was pretty unfair... my solution would work if you had tried it. I wonder if ...
coupon expires8/9/2008
  Q: … im trying to make a script that will have a coupon expire… When they go on the net the day they ...
  A: You need to set a cookie on the page they visit which lasts for 30 days. Then when the thirty days ...
Perl, file names8/6/2008
  Q: If for example I have files with name like "email-data1", "email-data2", etc, is there a way to ...
  A: I think what you're wanting to do is to SEARCH for files that have a certain criteria, in this ...
Uploading Multiple Large Files7/23/2008
  Q: I am trying to set up a site to design calendars using my users pictures. In order to do that I have ...
  A: The best way is to do the uploads in stages... If there are 12 pictures for 12 months, then do four ...
Perl loop7/22/2008
  Q: I need to generate random numbers that will be file names, and test for each number (file) that the ...
  A: Your code is more "C-ish" than Perl-ish. Your loop is like that, especially, and you shouldn't ...
combo box with Perl7/14/2008
  Q: .. Thanks for ur vital info....Would you please provide remedy to this issue please.....I am new ...
  A: You mean this? print qq~ <form> \n~; my $selected_switch; foreach my $list_item (@options_list){ ...
include perl code in another perl script6/28/2008
  Q: I have a set of perl scripts that are used for event registration, each calling the next and passing ...
  A: I've had this same type of problem, so I can give you some suggestions on how to solve it. First, ...
Form Security6/22/2008
  Q: You've helped me before. Now Im working on a shopping cart script. I've got a form which has a ...
  A: nice to hear from you again. I trust you're well. Sorry you had to wait for a couple of days. This ...
repopulating CGI option fields6/18/2008
  Q: I have a CGI form that gathers information and writes it to a database. I would like the user to be ...
  A: Sorry for the delay in replying. You need to work through the options in a loop, and when you ...
Responded to autoresponder.6/4/2008
  Q: >Can you tell me first what you are trying to accomplish? I don't understand exactly what you want ...
  A: This is pretty involved to get into over email. My best suggestion would be to use a different ...
CGI-BIN Email question.5/21/2008
  Q: I have a very basic website. It has a form that sends the input fields from that form to a ...
  A: This is not difficult to do. The passed variables will be ignored because when the form is ...
Retrieve pdf file from post data5/20/2008
  Q: I am posting a pdf file/image file on an apache webserver. I post it on a perl file which as of now ...
  A: I just answered a similar question from you. I assumed you were trying to upload the binary file. ...
cgi form script: SEND_MAIL vs. #SMTP_SERVER5/13/2008
  Q: I'm trying to get this cgi script to work -- i've been getting a "MAIL NOT SENT. SMTP ERROR:" -- ...
  A: First, you need to confirm the location of sendmail on the server. It might not be usr/lib/sendmail. ...
breaking out of a loop5/6/2008
  Q: With regards to your answer to the question posted here: ...
  A: Good point, no it would kill the script. The better solution would be to use LOOP and last LOOP. ...
Link MS Excel with Internet Explorer4/29/2008
  Q: This is a part of a project that i am doing.... the thing is that i want to link MS Excel with ...
  A: There really isn't any easy way to do this. The only way I can imagine it as possible would be to ...
printing to a local printer from the web4/8/2008
  Q: I have asked this question in the networking side and was told to ask it here, so I thought I would ...
  A: I suggest you actually do create PDFs on the fly. Here's an example of this: ...
Concatenating in perl3/11/2008
  Q: I wanted to concatenate environment variable's name to a report file transfered to a server. May i ...
  A: I don't understand your project... environment variables are always a hash, in the $ENV. Perhaps ...
Concatenating in perl3/11/2008
  Q: I wanted to concatenate environment variable's name to a report file transfered to a server. May i ...
  A: I'm a little confused by your project. Where does your environment variable come from? This line: ...
Follow-up2/21/2008
  Q: The "follow up" button does not work, so I write a new message.. The old message at ...
  A: I wasn't the person who answered your question the first time... so I don't know the history of the ...
how to break out of a loop when it takes too long to run2/21/2008
  Q: I am using Perl to do some pattern matching. I have say 500 files, and i wrote a loop to read ...
  A: You can put a time out by doing something like this: my $wait_timer; # maximum number of attempts ...
File::Basename suffix is not showing2/18/2008
  Q: #!/usr/bin/perl# use File::Copy; use File::Basename; print "Enter an HTM (HTML) file: "; chomp ...
  A: Not sure I entirely understand, but I think you're looking for files that end in .html and renaming ...
Deleting a particular line in a file using CGI2/8/2008
  Q: How do i delete a particular line in a file by using a cgi script.
  A: See this page for a complete answer: ...
How to implement CAPTCHA in my form handling script1/26/2008
  Q: I added CAPTCHA to my contact html form But I am not sure what lines to add (how to ...
  A: There are a number of CAPTCHA options out there-- this one is free: http://www.captcha.net/ I can't ...
Perl CGI1/21/2008
  Q: I am sending you the output of your script regarding my question at the end of this mail. Your ...
  A: OK, so the cookie is not showing up in the environment variables. How it works is that after you ...
formmail.cgi1/20/2008
  Q: I have a site using formmail.cgi to email a online form to me but once i recieve it in email and try ...
  A: You'll need to open the formail.cgi script and modify the section of the script that contains the ...
Perl CGI1/18/2008
  Q: I have created a cookie in this cgi script after validating the user. My problem is that this cookie ...
  A: Cookies are sent as part of the header, before the actual content of the page. The server prints ...
generate an HTML page and list directory content1/12/2008
  Q: How can generate an HTML page with a Perl CGI script that lists the content of a given directory, ...
  A: What you need is a "file manager" type of script. There are many of these scripts available for ...
ive a script and i want ot put words on front page, i have it in word but it breaks script1/6/2008
  Q: can you help me?? nobody will do anytihgn but jsut say "edit blah/blah/blah which DONT WORK i go ...
  A: Send me your URL. You can't edit scripts in Word. You need to use Notepad. You need to know some ...
bnbform help.12/23/2007
  Q: ok, so I am trying to use the bnbform. I get NO ERRORS!!!!! ~BUT~ here is the link: ...
  A: My best guess is that there is some restriction on your server as to sending email. It could be ...
membership area program stops running12/22/2007
  Q: I have three sites that use the same program to control access to their own members area. These have ...
  A: It could be that file paths have changed... if your scripts use hard-coded file paths, then they'll ...
Software11/21/2007
  Q: It is not a question about Perl scripting itself: I am writing Perl scripts and am looking for a ...
  A: There is no simple way to encrypt Perl scripts. You can make them hard to read though, by ...
Problem Regarding CGI script10/30/2007
  Q: I have created a html form given below. #!c:/perl/bin/perl print "content-type: text/html\n\n"; ...
  A: Oh, OK, I think I understand. It's quite easy actually-- just have the target to the anchor open in ...
Perl Script to convert HTML table to CSV file10/26/2007
  Q: I'm trying to write a script that will download data from a website (in an HTML table) and dump it ...
  A: This is a complex question to describe in a simple email, but here's how I would approach it. 1. ...
Regarding CGI script10/23/2007
  Q: Respected Sir, I have written a short mail program using sender.pm module. I have created a script ...
  A: I don't see anything wrong with the script. The attached files should be sent through the browser, ...
Regarding CGI script10/23/2007
  Q: I have installed apache httpd server on my local machine(window xp). I have some perl cgi script ...
  A: This isn't really a cgi question, but a networking, or a platform question. I'll take a shot tho: I ...
perl error10/20/2007
  Q: This is a perl script that I have: #!usr/bin/perl print "Content-type:text/html\n\n"; print ...
  A: Here's a better way to do what you're wanting: #!usr/bin/perl print "Content-type:text/html\n\n"; ...
Birdcast cgi script10/18/2007
  Q: I have installed the birdcast.cgi script on our web site for send a friend this page, it seems to ...
  A: Sometimes when scripts are sent from web servers, they are more likely identifieed as potential ...
Problem in CGI script10/17/2007
  Q: I have apache server installed and a data base made in ms access. The following script is running ...
  A: That's a really good question! This script looks perfect to me on first glance, and it it runs in ...
Permissions question10/15/2007
  Q: I have a cron task that runs a perl script located in the cgi-bin folder (unix server). Is that ...
  A: As far as I know, there is no way to do this with permission. Perhaps you could add a CHMOD to the ...
Mulitiple page forms10/5/2007
  Q: I am trying to create a cgi that will read information from one form, paste it to a file on the ...
  A: When you create your form, after you've printed the results to a file, you'll want to display a ...
Mulitiple page forms10/5/2007
  Q: I am trying to create a cgi that will read information from one form, paste it to a file on the ...
  A: Most form processing scripts let you specify a custom thank you page. If you can't make that thank ...
Can I Run a Perl CGI on My PC using ActivePerl?10/3/2007
  Q: I have a an HTML file and PERL file which mails a form. My installation will not let me run Perl ...
  A: When the form is submitted, the Perl script reads the contents of the submission and decides what to ...
guestbook using cgi and html9/25/2007
  Q: I am trying to install a guestbook from bignosebird.com. I have tried everything to get it working ...
  A: That pop up prompting to save means that the browser doesn't know what to do with the file type... ...
String in a file9/4/2007
  Q: I have a file of data, by line: data0/email/data1/data2/data3 ...
  A: You want to open the file, work through it line by line looking for the string, and when you come to ...
i really need to learn more about forms - can you help?8/27/2007
  Q: new to the site and their very nice system here. I'm not a programmer, although would love to start ...
  A: It's a hard type of question to troubleshoot without getting in there and messing around. I'm afraid ...
Perl/Red Hat Linux to VB.Net/SQL server 20008/27/2007
  Q: I have some know how of VB.Net/ASP.Net and SQL server 2000/2005. I may have to work on converting ...
  A: I don't have direct experience in this area, but I see this question has been here for a while, so I ...
i really need to learn more about forms - can you help?8/25/2007
  Q: new to the site and their very nice system here. I'm not a programmer, although would love to start ...
  A: Sorry for the delay. I looked at the source for the jvcreativity site, and then the source for the ...
i really need to learn more about forms - can you help?8/25/2007
  Q: new to the site and their very nice system here. I'm not a programmer, although would love to start ...
  A: Send me the URL of the various forms-- the one that works, and the others, and I'll look at the HTML ...
cgi script/form no data sent to email8/22/2007
  Q: I have some questions. is there any way you can look at how I have my form and script setup right. ...
  A: Yes, sendmail is for Unix and Linux. I am not very familiar with sending mail on a Windows server. ...
cgi script/form no data sent to email8/21/2007
  Q: I have some questions. is there any way you can look at how I have my form and script setup right. ...
  A: It's hard to say-- the first thing to check when you don't get an email is that you have the path to ...
i really need to learn more about forms - can you help?8/21/2007
  Q: new to the site and their very nice system here. I'm not a programmer, although would love to start ...
  A: Not sure if I just answered you-- I just had a question similar to this one, about the same ...
Copy entire dir tree8/13/2007
  Q: Your name is very familiar to me, we must have communicated before.. or you probably answered other ...
  A: Sorry, I thought you knew enough Perl to put it together. Here's a sample script: <code> ...

All Questions in This Category

Perl & CGI

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jason Silver

Top Expert on this page

Expertise

I can answer questions about script installation problems. I can give hints and tips for writing code. I can suggest the best approaches for writing web applications, and other similar topics.

Experience

I've been writing Perl scripts since 1999. I sell my scripts at www.intelliscript.net

Education/Credentials
I'm self taught in computer programming.

Awards and Honors
I've been quoted in a computer programming publication, called CGI-101.

©2012 About.com, a part of The New York Times Company. All rights reserved.