Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: match pattern from two different file

by Anonymous Monk
on Jun 20, 2014 at 06:42 UTC ( [id://1090563]=note: print w/replies, xml ) Need Help??


in reply to match pattern from two different file

This is syntax error
if # you forgot some parens here, like someone said { $line1=~ /^$pattern/; $line2=~ /^$pattern/; $line1==$line2; { print $line1; } }
Also
my $pattern='/^LOC_Os0[1-7]g[0-9]*.[0-9]\s'; ... $line1=~ /^$pattern/; # $line1 (and 2) will expand to smth like /^^LOC_0s.../, which is prob +ably not what you want. Try my $pat = qr/^LOC_0s.../ $line1 =~ $pat;

Replies are listed 'Best First'.
Re^2: match pattern from two different file
by Anonymous Monk on Jun 20, 2014 at 06:45 UTC
    I mean patterns, not lines, will expand to that. They will start with double ^. That is a regex error.

      I remove the if condition and change it pattern according to u .it runs but result is not as it should be. the whole file comes as output

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1090563]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-25 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found