The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl -write values in a file to @array in perl meghana Shell Programming and Scripting 12 07-17-2008 01:38 PM
[PERL] Running unix commands within Perl Scripts userix Shell Programming and Scripting 1 05-28-2008 03:06 PM
Calling a perl script from a perl script new2ss Shell Programming and Scripting 3 02-06-2007 08:17 PM
Perl: Run perl script in the current process vino Shell Programming and Scripting 10 12-09-2005 07:45 AM
Replace Perl Module name in all Perl scripts rahulrathod Shell Programming and Scripting 2 12-01-2005 10:00 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-18-2008
Registered User
 

Join Date: Jan 2008
Location: India
Posts: 2
help in perl

Hi,
I have a small doubt regarding my program. Hope you will help me in solving that.

Example:

$a="agaaaagavvgglggy"
$b=<STDIN>;

let the input seq is "ttttttttttagaaaagavtttggyttttttt";

here the input matches with $a only with the letters in bold : ttttttttttagaaaagavtttggyttttttt

i want to know what we can do to give input showing both matches and mismatches in the input.(mismatch shold me shown as a hiphen)
That means the output should be like this:
The given sequence matches with the pattern at - - - - - - - - - - agaaaagav- - -ggy - - - - - - -

Hope you will help me in solving out this.

Thanks in advance,
siri
Reply With Quote
Forum Sponsor
  #2  
Old 01-21-2008
Registered User
 

Join Date: Jul 2007
Location: India
Posts: 14
Jus try out this . I am trying "aga" as the string to match.

#!/usr/bin/perl -w
$a="aga";
print "input string : \n";
$b=<STDIN>;
if ( $b=~/($a)/ )
{
print "matched part: $1 \n";
print " part before matched $` \n";
print " part after matched $' ";
}
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0