http://www.perlmonks.org?node_id=994367

randomhero1270 has asked for the wisdom of the Perl Monks concerning the following question:

Hi! I am very new to perl. I love programming but I am just not very good at it. I am trying to use regex's to read a file which contains a bunch of these R00005: 00330: C01010 => C00011 R00005: 00791: C01010 => C00011 R00005: 01100: C01010 <=> C00011 R00006: 00770: C00022 => C00900 R00008: 00362: C06033 => C00022 R00008: 00660: C00022 => C06033 R00010: 00500: C01083 => C00031 R00013: 00630: C00048 => C01146 R00013: 01100: C00048 <=> C01146 what it needs to do is print the R_____ then whichever => follows it. for example it would need to find R00008 and print => I don't really understand how regex works so I started with this

use strict; open(DNA, 'reaction_mapformula.lst'); while(my $protein = <DNA>) { if(my $protien =~ m/^R\d\d\d\d\d$/){ print "it"; }else{ print "no"; } }
and it just prints nononononononononononono etc... I thought that was right? any help is appreciated thank you!