473,750 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ht ml">
#
# 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=sp lit(/,/,$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 3029
lo************* @my-deja.com (lonelyplanet99 9) wrote in message news:<2c******* *************** ****@posting.go ogle.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.go ogle.com>...
lo************* @my-deja.com (lonelyplanet99 9) wrote in message news:<2c******* *************** ****@posting.go ogle.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 (lonelyplanet99 9) 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
4107
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. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
31
4801
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 great for pattern matching, text processing, and automated testing. Our company is really fixated on risk managnemt and the only way I can do enough testing without working overtime (which some people have ended up doing) is by automating my...
23
2035
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 general purpose OO programming language that finds use among some system administrators, but my guess is that Perl is still more common in that area than Python. For sysadmin-related tasks, is Python as useful as Perl, or does it get clumsy when...
2
2202
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 student and all, and I have looked at several bookstores for books about perl and: 1. I don't know what topics I should be looking for to learn the basics of the perl language. 2. Most of the books are too much for me to shell out right now...
2
9920
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 what I should do next in the batch file?
7
2152
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 things? Regards, Ajar
12
2359
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
34432
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
9
1314
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. someone else errors to fix) in Perl. However, I have just found out that there is a way to import the Perl interpreter within Python!!! I now believe I can utilize python as the main platform to develop the project upon !!
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6808
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.