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

How to print out the count the word in Perl?

47
Hi, I have a problem with counting in Perl..please help

how can I print the 3 words and count it in the word "Dic-tion-a-ry

I want to pirnt 3 word = Dic => count it = 3
and Next tion => 4

can someone give me a hand.
thanks
Mar 10 '11 #1

✓ answered by Rabbit

You can use the join function to concatenate an array. But the length function should give you the length of a string.

11 2542
Rabbit
12,516 Expert Mod 8TB
First of all. That's not three words. That's only one word. Second, I assume you meant syllable, but it's not even three syllables, it's four. Third, to count syllables, you need an algorithm that will break a word up into syllables. We will not do that for you here, but we can help you if you get stuck somewhere while you're creating your algorithm. But you will have to post the code you're using.
Mar 10 '11 #2
Wiinie
47
my algorithm works fine in my code
and I can make a syllables in 1 word.
and can you help me how to count the word

dic~tum~st
and I want to cut it and count it
count(dic).. something like this.. do you know any way in Perl that can help me



thanks
Mar 10 '11 #3
Rabbit
12,516 Expert Mod 8TB
I'm not even sure what it is you're counting. You say you're counting words but you're not counting words cause you only have one word.
Mar 10 '11 #4
Wiinie
47
sorry about that . I try to count the character in the word
Mar 10 '11 #5
Rabbit
12,516 Expert Mod 8TB
The length function will give you the amount of characters in a string.
Mar 10 '11 #6
Wiinie
47
it doesnt work cuz the length only works if there is an array///
I have figure out how to split it
other question.

Do you know how to add the array
I have
@array = ('Dic', 'tum','st');
i want to add array[0] to array[1],
so the array[1] = 'Dictum';


can you please help me for this..

thank you very much..
Mar 10 '11 #7
Rabbit
12,516 Expert Mod 8TB
You can use the join function to concatenate an array. But the length function should give you the length of a string.
Mar 10 '11 #8
Wiinie
47
Do you know there is anyway to count the matching time
Dic~tum~st

I want to count the time that "~" sign appear..

thank so very much
Mar 10 '11 #9
Wiinie
47
the join function , it doesnt work

Expand|Select|Wrap|Line Numbers
  1. $word= "dic~tum~st";
  2. @splitedWord = split(/~/, $word);
  3.                     print "Splited Word: @splitedWord\n";
  4.                     $first = @splitedWord[0];
  5.                     print "first : $first \n";
  6.                     @splitedWord[1] = join('$first', @splitedWord[1]);
  7.                     print "Joined @splitedWord[1]\n";
  8.  

it doesnt work
Mar 10 '11 #10
Rabbit
12,516 Expert Mod 8TB
It's not working cause you're passing a single item in the array. For a join you need to pass an array, not a single item.
Mar 10 '11 #11
Wiinie
47
can you give me an example please..
I am a new in Perl so there are something that I may not understand all..


Thanks
Mar 10 '11 #12

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

Similar topics

3
by: SpamProof | last post by:
I'd like to be able to print multiple documents are once using vb.net. What is the best way to do this with out having to print each document one at a time via a loop . Can't I send them all to...
3
by: Shyguy | last post by:
I have a MS Word Merge letter that is based on a query. I set up a macro to run the query and then open Word and the merge letter. Word open fine but it can't find the letter. I used RunAPP and...
0
by: Marius Eichler | last post by:
hi there, I'll view my word document in any art of kind, before I print this. The most example are generate simple any text or read from a text file. The Word COM object starts the view and the...
0
by: srivalli chavali via DotNetMonster.com | last post by:
Hi, I have to print a word document using C#.NET. I also have to customize the printing option, the Printer tray, programmatically. So, I have used the PrintDocument class available in C#....
0
by: nfilbeck | last post by:
I have a table with a hyperlink field to Word documents. How do I call the application (Word) and print the document indicated in the hyperlinked field? :confused:
1
by: TommyG | last post by:
I have an Access report that I want to print with a standard "terms & conditions" page that is set up in word. How can I accopmplish this??
1
by: Quiris | last post by:
Hello, I have a Ms Access database, and linked some Ms Word documents to it, so I can print the data in the database nicely into a letter. In Word, I can search for a certain record of my...
66
by: happyse27 | last post by:
Hi All, my html code is sno 1) and perl code is sno 2). a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
1
by: esperanto234 | last post by:
Hi, i need a VBA code for printing between bookmarks in a Word doc I also need to change 2 printing options: 1) Print from Tray 3 2) Print in both sides of the paper Thank you very much
4
by: darko | last post by:
hello im doing a small rss project and i'm stuck at trying to count how many items are in the feed, my question is: how can i count the instances of a word, in this case <item> in a string(source),...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.