in reply to create hashes using regex

If you put these points into action, it could look like the code below. I am reading from the DATA handle for convenience and read all lines into an unnamed array.

use strict; use warnings; my %hash = map { /(TCONS_00[0-9]+)\s+(XLOC_[0-9]+)/ } <DATA>; my @keys= keys %hash; my @values= values %hash; print "@keys\n"; print "@values\n"; __DATA__ TCONS_00000047 XLOC_000039 TCONS_00000718 XLOC_000456 TCONS_00000938 XLOC_000610 TCONS_00004086 XLOC_002872 TCONS_00004252 XLOC_003003 TCONS_00004975 XLOC_003624 TCONS_00004976 XLOC_003624 TCONS_00005492 XLOC_004020

Replies are listed 'Best First'.
Re^2: create hashes using regex
by bingalee (Acolyte) on Jun 12, 2013 at 18:33 UTC
    thank you so much..