Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Trouble with Transliterate Function

by jwkrahn (Monsignor)
on Aug 29, 2013 at 09:31 UTC ( #1051392=note: print w/ replies, xml ) Need Help??


in reply to Trouble with Transliterate Function

my $mask_input = <INPUT>; ... my $lastEnd = 1; while ( <INTERVAL> ) { my (undef, $start, $end) = split '\s', $_; ## change everything from the end of the last range ## to the start of this range to 'N' substr( $mask_input, $lastEnd, $start ) =~ tr[\x00-\xff][N]; $lastEnd = $end; } ... print OUT "$mask_input";

Another way to do that:

chomp( my $mask_input = <INPUT> ); my $new_mask = 'N' x length $mask_input; ... while ( <INTERVAL> ) { my ( undef, $start, $end ) = split; --$start; substr $new_mask, $start, $end - $start, substr $mask_input, $star +t, $end - $start; } ... print OUT "$new_mask\n";


Comment on Re: Trouble with Transliterate Function
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051392]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (18)
As of 2015-07-30 14:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls