perl - how to expand the file based on the numbers which have given in the input file? -


i have 1 input file

mod_glcnhglycan 264-268 dtsgt

i have output follow mod_glcnhglycan 264 d mod_glcnhglycan 265 t mod_glcnhglycan 266 s mod_glcnhglycan 267 g mod_glcnhglycan 268 t

my $str = 'mod_glcnhglycan 264-268 dtsgt'; ($name, $range, $chars) = split ' ', $str; ($start, $end) = split '-', $range; @chars_arr = split '', $chars; @results = (); foreach $char ( @chars_arr ) {     push @results, $name, ' ', $start++, ' ', $char; } 

results in array containing:

mod_glcnhglycan 264 d mod_glcnhglycan 265 t mod_glcnhglycan 266 s mod_glcnhglycan 267 g mod_glcnhglycan 268 t 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -