Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: substr is behaving differently with small vs large strings

by qq (Hermit)
on Jul 07, 2004 at 21:37 UTC ( [id://372560]=note: print w/replies, xml ) Need Help??


in reply to substr is behaving differently with small vs large strings

I don't think substr is your problem:

#!/usr/bin/perl my $pad = 100_000_000; my $s = 'a' x $pad; $s .= 'qq was here'; $s .= 'b' x $pad; print substr( $s, $pad, 10 ), "\n"; # qq was here

If you save the return from editcontig to a file, and find the character position that should be the start of the substr, is it actually off?

Its more likely that editconfig is stripping out more or less than it should. Perhaps there is some other character in your longer file? BTW, you can condense editconfig to something like:

sub editcontig { my $rawseq = shift; $rawseq =~ s/\s+//g; $rawseq =~ s/[0-9]//g; return $rawseq; }

and you could validate the output by adding:

if ( $goodseq =~ /([^actg]+)/ ) { die 'found unexpected character $1"; }

qq (who knows nothing about genes)

Replies are listed 'Best First'.
Re^2: substr is behaving differently with small vs large strings
by qq (Hermit) on Jul 07, 2004 at 21:42 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-25 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found