Hi,
I'm a newbie to perl and is now studying about perl programming, I
read some perl programming tutorials online (enter 'Perl tutorial' at
google.com) and also find some sample perl scripts for study.
For below statements I couldn't understand what is the function of
'$in'. I tried to search through the perl script tutorial pages since
this morning (now it's afternoon) but still couldn't find the
explanation. Could anyone help what's the meaning or where to find url
with explanation of such syntax ?
1. $index=$in{ind} if($in{ind});
2. $startfile=$in{startfile};
I couldn't ask the script author as he stated in the script the script
will not be supported.
Tks!
#!/usr/local/bin/perl
################################################## ################################
# WEBSITE KEYWORD SEARCH
# (c) Global Data Industries
# www.gd-ind.com
#
# This script is freeware and may be freely distributed but must not
be sold.
# e-mail support for the script is unfortunately not available,
although please
# e-mail bug fixes/enhancements to myself at ph****@gd-ind.com :-)
#
# sitesearch.pl allows a web site to be searched against keywords or
"" enclosed
# phrases. A + in front of the word/phrase means that this word/phrase
is
# required, a - means that this word/phrase must not appear in any of
the returned
# links.
# The script requires a filename as the 1st search file, it will then
recursively
# follow all the HTML hyperlinks on the page, allowing "whole site or
this section
# only" searching to be performed.
# Returned links are sorted for confidence.
#
# Your form needs to pass 2 things: a Text Box called "keywords", e.g.
# <INPUT TYPE="TEXT" NAME="keywords"> and a input field, (can be a
hidden, radio
# or textbox) with the file name to start the search from, called
"startfile"
# e.g. <INPUT TYPE=HIDDEN NAME="startfile" VALUE="index.html">
#
# You'll need to go through the script, changing a few things to make
it work
# on your setup!
#
# V1 15/1/99 Phil Anderson.
# (created)
#
################################################## ################################
require 'cgi-lib.pl';
# change this to the root HTML directory of your site as seen by
# HTTP, e.g. if your URL is www.mydomain.com/mysite the root
# would be $htmlroot="/mysite". Leave it empty if you're using
# the server root
$htmlroot="";
# change this to the absolute path to the HTML directory on your
# web server. If you are using something like WSFTP, log on to
# your server, change to the html directory- the full path to
# it will be given in the listbox on the top!
chdir("server/users/me/public_html");
# change this to the path to your CGI directory
$cgidir="/cgi-bin";
################################################## ################################
# if you've got everything above right, this script should run. the
only stuff that
# needs changing below here is the HTML that is used to format the
script's search
# returns.
# change this to however many links you want returned on each search
$maxlinks=10;
################################################## ################################
# start the program
&ReadParse;
undef $/;
$index=1;
$index=$in{ind} if($in{ind});
# array @ignorefiles contains the list of filenames we're not
# to bother following if found as links
@ignorefiles=split(/,/,$in{ignore});
# startfile is the top-level file we're to look at.
$startfile=$in{startfile};
.... other content trimmed as they are not related to my question.