LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-19-2009, 12:43 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
simple perl script not working


hi all.......

$string='summary';
if($test =~m/($string)/i)
{
$test=~ s/$1/$string/g;
}

here substitution not taking place even if summary word present in $test
is there any mistake in the code....

can anyone please help me...

Thanks in advance....
 
Old 06-19-2009, 01:13 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by vinaytp View Post
hi all.......

$string='summary';
if($test =~m/($string)/i)
{
$test=~ s/$1/$string/g;
}

here substitution not taking place even if summary word present in $test
is there any mistake in the code....

can anyone please help me...

Thanks in advance....
I got it correct i was matching test instead of text ...that was the mistake...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Simple Perl Script To Ease Console Server Use On Linux And Unix LXer Syndicated Linux News 0 06-25-2008 01:30 PM
LXer: Simple Perl Script To Demonstrate DNS Name Lookups In Linux LXer Syndicated Linux News 0 05-24-2008 07:50 AM
Very simple question, installing script for Perl lexington Linux - Newbie 1 06-07-2004 04:55 AM
simple bash script not working. e1000 Programming 4 01-14-2004 12:09 AM
Looking for simple way to create scheduled emails from perl script kdowney Programming 1 10-17-2003 06:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration