473,385 Members | 1,546 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,385 software developers and data experts.

index() vs perl()

blackgoat
Hi!

If a paragraph needs to be teaversed to find all occurances of words ending with a certain pattern(eg *ing), then which will be a better option to use and why? index() or pos().

Thanks

BG
Feb 16 '10 #1
3 1515
numberwhun
3,509 Expert Mod 2GB
Have you examined the perldoc pages for each of those functions to find out what they do and try to determine which would be best?

Its not that i don't want to answer your question, its just that the way you asked it, it sounds like a question your teacher asked you because they want you to learn. I cannot bring myself to do your school work for you.

Regards,

Jeff
Feb 16 '10 #2
Well, sorry if you get that impression, but I have not been asked by a teacher. I have gone through the perldoc pages and I felt that they would both work in the same manner. But 1 particular tutorial suggested the usage of pos() over index(). The reason for this was not clear so got stuck, hence I posted the question. Can you please explain, I'll be greatful.
Feb 17 '10 #3
numberwhun
3,509 Expert Mod 2GB
I have used index() but haven't done anything with pos() as of yet. index() is a function specific to strings though, and returns the first occurance of a specified substring in a specified string.

pos() on the other hand is a function specific to regular expressions alone. If you read the Perl Regular Expression reference , under "Assertions" section 2nd paragraph, you will see its first mention. That page may give you more information on it, but these two functions are certainly not the same and serve different functions.

Hope that helped.

Regards,

Jeff
Feb 17 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jofio | last post by:
Hello, I am a newbie in PHP and I am enthusiastically trying out things. I've just replaced my index.html ( file with index.php
2
by: Gary | last post by:
Whatever I try I do not seem to be able to get the keys to be Descending. I assume collation A means Ascending which indeed they are when I enter DATA ? I use CREATE TABLE WGSubCategory (...
9
by: Robert Brown | last post by:
If I use _reverse_ wildcard search will it always result in a table scan? Is it possible to get the DB (Oracle or SQL server) to use indexes when doing reverse wildcard match? let's say I have:...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
17
by: Jeffrey W. Baker | last post by:
Greetings, I have a 23GB data table upon which I am building a primary key of three columns. The data is mounted in a 137GB device and pg_xlog is mounted on a separate 3.5GB device. I have...
2
by: gen_tricomi | last post by:
THE IMPORTANCE OF MAKING THE GOOGLE INDEX DOWNLOADABLE I write here to make a request on behalf of all the programmers on earth who have been or are intending to use the Google web search API...
77
by: Nick Maclaren | last post by:
Why doesn't the tuple type have an index method? It seems such a bizarre restriction that there must be some reason for it. Yes, I know it's a fairly rare requirement. Regards, Nick...
14
by: marcpenninga | last post by:
This is *not* an attempt to start yet another Python-versus- AnyOtherProgrammingLanguage flame war, but I thought people might be interested in this: http://www.tiobe.com/tpci.htm Marc
7
by: chanshaw | last post by:
Ok I'm looking to find the array index of the entered employee number here is my code #!/usr/bin/perl # Uses module Text::CSV # compiler directives use strict; use warnings; use Text::CSV;
2
sagacious
by: sagacious | last post by:
Hello TO All.. It Been Just Some Years That I Have Worked With WML, Html, Php, Css, Ajax And My SQL.. Now New Entered in Perl, Python ; World... I Have 2 Search Engine Script Which Starts...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.