473,408 Members | 2,734 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,408 software developers and data experts.

How to count matching sign in string in Perl?

47
Do you know there is any ways to count the matching time
Dic~tum~st

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

thank so very much
Mar 10 '11 #1
1 2018
miller
1,089 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. my $str = 'Dic~tum~st';
  2.  
  3. my $count = $str =~ tr/~/~/;
  4.  
  5. print $count;
  6.  
Mar 10 '11 #2

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

Similar topics

6
by: Petterson Mikael | last post by:
How can I count all java packages that contains fpx in their name using xslt? cheers, //mikael I have the following data: <report>
3
by: Kuups | last post by:
Hi! I have a question regarding the count if character within a string like for example I have a string of e.g. 123#123# I would like to determine what is the code? of getting the # sign
8
by: Amit Khemka | last post by:
Hello All, say you have some string: ", foobar " Now i want to extract all substrings for which "isinstance(eval(substr), list)" is "True" . now one way is to walk through the whole sample...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
24
by: Derek Hart | last post by:
Is there an efficient line of code to count the number of instances of one string within another. If I have the sentence: "I want to go to the park, and then go home." It would give me a...
3
by: Dana King | last post by:
I'm looking for some other developers opinions, I'm trying to find the best way to count strings within a string using VB.net. I have tested five methods and have found the String.Replace method...
4
by: thomas | last post by:
I have a list of strings composed of only 0 and 1, like 0000100001 1000010000, .... They all have the same length. Now they are stored in a vector of strings. I want to calculate count(string1...
5
by: billa856 | last post by:
Hi, I have string like below and i wanna count nos in that string 1st string ;0;80;0;0;39;0;0;0;81;42;5;100;0;0 in this string there are 6 Nos. 2nd string...
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: 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...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.