and a Hash of Arrays that has ranges of numbers in pairs :>my_id ---------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +----------------------------
What I want to do, is to substitute the - with A for every range that is mentioned in all the arrays of the HoA.123-186 188-259 263-340 1-93
How will I continue in order to substitute, e.g. all characters between position 123 and 186 from - to A?my $id = '------------------------------------------------------------ +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +--------------------------------------------------------------------- +-------------------------------------- '; foreach my $l ( 0 .. $#{ $HoA{$id} } ) { my $separate_range = $HoA{$id}[$l]; if($separate_range=~/(\d+)\-(\d+)/) { my $hit_beg=$1; my $hit_end=$2; my $hit_length=$hit_end-$hit_beg+1; } }
In reply to How do you perform this substitution? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |