wood burning stoves 2.0*
The moose likes Perl and the fly likes perl  String find and replace - count ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Perl
Bookmark "perl  String find and replace - count ?" Watch "perl  String find and replace - count ?" New topic

perl String find and replace - count ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
perl -pi -e 's/sample1/sample2/g' *.* replaces string value sample1 with sample2 globally. How do i add count (number of times sample1 string replaced) ?
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11170

perlmonks is always a great place to search. I found this, which appears to be your exact question.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
subject: perl String find and replace - count ?
Similar Threads
script for help
Is it possible to call a action of one war file from action of another war file?
Single type import error.
shift question
Help In displaying properties of objects contained in ArrayList