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


in reply to Re^3: hash with both values and keys unique to each other
in thread hash with both values and keys unique to each other

As a side note, you can clean up that regex quite a bit by using + instead of {1,}, and not escaping colons, semi-colons, and equals:

#if($line=~/^(Gm\d{1,})\trecent_duplication\tsyntenic_region\t(\d{1 +,})\t(\d{1,})\t.*\tID\=\w{1,}_Gm\d{1,}\.(Gm\d{1,}.*)\;median_Ks=(.*)\ +;matches\=(Gm\d{1,}\:\d{1,}\.\.\d{1,})/) if($line=~/^(Gm\d+)\trecent_duplication\tsyntenic_region\t(\d+)\t(\ +d+)\t.*\tID=\w+_Gm\d+\.(Gm\d+.*);median_Ks=(.*);matches=(Gm\d+:\d+\.\ +.\d+)/)

Replies are listed 'Best First'.
Re^5: hash with both values and keys unique to each other
by Anonymous Monk on Jul 12, 2012 at 22:18 UTC

    You could clean it up quite a bit more by splitting the line on tabs and parsing each of the columns individually...