IT Community - Software Programming, Web Development and Technical Support

How would you replace a char in string and how do you store the number of replacement

This is a discussion on How would you replace a char in string and how do you store the number of replacement within the Perl forums, part of the Software Development category; How would you replace a char in string and how do you store the number of replacements?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Perl

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-15-2007, 07:23 PM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default How would you replace a char in string and how do you store the number of replacement

How would you replace a char in string and how do you store the number of replacements?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2007, 04:34 AM
Gopisoft Gopisoft is offline
D-Web Sr.Programmer
 
Join Date: Feb 2007
Posts: 117
Gopisoft is on a distinguished road
Default Re: How would you replace a char in string and how do you store the number of replace

Hi,

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
$str='Hello';
$cnt= ($str=~s/l/i/g);
print 'Count is :';
print $cnt;
Ouput

Quote:
Count is :2
-R.Gopi
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between CHAR and VARCHAR data types? sundarraja Database Support 1 02-01-2008 10:36 PM
How do I convert a Number into a String with exactly 2 decimal places? itbarota HTML, CSS and Javascript Coding Techniques 2 10-26-2007 05:22 AM
Use ereg_replace to replace only the first occurence of a string instead of all itbarota PHP Programming 1 09-12-2007 12:13 AM
Does automation replace manual testing? devarajan.v Software Testing 1 07-27-2007 05:35 AM
".Which one works fast concatenation or variable.. replacement ..? oxygen PHP Programming 1 07-26-2007 03:30 AM


All times are GMT -7. The time now is 01:07 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0