473,287 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Dummy perl programming question

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.
Jul 19 '05 #1
3 3013
lo*************@my-deja.com (lonelyplanet999) wrote in message news:<2c**************************@posting.google. com>...
I'm a newbie to perl and is now studying about perl programming,
In that case you should start learning to program in Perl5. There is
no point lerning to program for Perl4.
I
read some perl programming tutorials online (enter 'Perl tutorial' at
google.com) and also find some sample perl scripts for study.
The example script you enclose was clearly written in the style of a
Perl4 script. I can't say for sure that it was actually written to
run on Perl4 but it uses many Perl4 techniques that are now considered
very poor Perl5 programming style. So if it wasn't written for Perl4
it was written by someone who learned how to program for Perl4 and
never bothered to learn how to program for Perl5.

Throw it away. To not attempt to learn from it.

As a quick rule of thumb do not attempt to learn from any script
(other than a one-liner) that doesn't start 'use strict' as this is
usually a sign of a program (orgininally) written for Perl4 (or by
someone who learned how to program for Perl4 and never bothered to
learn how to program for Perl5).
For below statements I couldn't understand what is the function of
'$in'. 1. $index=$in{ind} if($in{ind});
2. $startfile=$in{startfile};
'in' is the name of a hash (string-keyed array) variable called %in.
$in{ind} refers to the element of %in with the key 'ind'.
Could anyone help what's the meaning or where to find url
with explanation of such syntax ?


http://www.perldoc.com/perl5.8.0/pod/perldata.html

Note: this is the same 'perldata' document as you'll find on your own
local disk in the manuals that were installed as part of Perl.

There's a lot of reference (and some tutorial) documentation included
with Perl. I suggest you take a look at the table of contents
(perltoc).

This newsgroup does not exist (see FAQ). Please do not start threads
here.
Jul 19 '05 #2
no****@mail.com wrote in message news:<4d**************************@posting.google. com>...
lo*************@my-deja.com (lonelyplanet999) wrote in message news:<2c**************************@posting.google. com>...
I'm a newbie to perl and is now studying about perl programming,
In that case you should start learning to program in Perl5. There is
no point lerning to program for Perl4.
I
read some perl programming tutorials online (enter 'Perl tutorial' at
google.com) and also find some sample perl scripts for study.


The example script you enclose was clearly written in the style of a
Perl4 script. I can't say for sure that it was actually written to
run on Perl4 but it uses many Perl4 techniques that are now considered
very poor Perl5 programming style. So if it wasn't written for Perl4
it was written by someone who learned how to program for Perl4 and
never bothered to learn how to program for Perl5.

Throw it away. To not attempt to learn from it.

I read this script not just because it is perl but it presents a
program that describes the logic of a simple search engine. If I don't
know about meaning of that mentioned statements, I have no way to know
the program logic behind at all.

As a quick rule of thumb do not attempt to learn from any script
(other than a one-liner) that doesn't start 'use strict' as this is
usually a sign of a program (orgininally) written for Perl4 (or by
someone who learned how to program for Perl4 and never bothered to
learn how to program for Perl5).
For below statements I couldn't understand what is the function of
'$in'.
1. $index=$in{ind} if($in{ind});
2. $startfile=$in{startfile};


'in' is the name of a hash (string-keyed array) variable called %in.
$in{ind} refers to the element of %in with the key 'ind'.

Is 'in' standard Perl keywords just line STDIN, etc ?
Could anyone help what's the meaning or where to find url
with explanation of such syntax ?


http://www.perldoc.com/perl5.8.0/pod/perldata.html

Note: this is the same 'perldata' document as you'll find on your own
local disk in the manuals that were installed as part of Perl.

There's a lot of reference (and some tutorial) documentation included
with Perl. I suggest you take a look at the table of contents
(perltoc).

This newsgroup does not exist (see FAQ). Please do not start threads
here.

Jul 19 '05 #3
lo*************@my-deja.com (lonelyplanet999) wrote:
Is 'in' standard Perl keywords just line STDIN, etc ?


The list of Perl special variables is in the 'perlvar' manual.

(BTW: the answer is 'no').
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
23
by: John M. Gabriele | last post by:
I recently posted this sort of question to the c.l.p.m but didn't get much of a response. I know a little Perl and a little Python, but master neither at the moment. I see that Python is a...
2
by: noone | last post by:
Hello all, I am absolutely brand new to perl, but I understand that it is a very important aspect of web development to create dynamic web pages. I am kind of short on money, being a college...
2
by: brad | last post by:
I am new to perl and would like to know how to check the return values of a perl program in a batch file. how can I save the return value of the perl program and use it to make decisions as to...
7
by: Ajar | last post by:
I want to write a program which will automatically login to my ISPs website, retrieve data and do some processing. Can this be done? Can you point me to any example python programs which do similar...
12
by: rurpy | last post by:
Is there an effcient way (more so than cgi) of using Python with Microsoft IIS? Something equivalent to Perl-ISAPI?
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
9
by: Blubaugh, David A. | last post by:
Sir, You are absolutely correct. I was praying to G_d I did not have to slaughter my project's source code in this manner. However, like life itself, I was given legacy source code (i.e....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.