Bioperl: manipulating long strings (genomes) in PERL

Ian Korf ikorf@sapiens.wustl.edu
Mon, 29 Mar 1999 13:01:16 -0600 (CST)


Is it possible you have code that does something like this?

my $seq = "";
while (<FH>) {
	chomp;
	$seq .= $_
}

If so, you may be causing reallocations as Perl keeps the scalar contiguous.
Here's an approach that should work better.

my $seq;
LOCAL_BLOCK: {
	my @seq = <FH>;
	chomp @seq;
	$seq = join("", @seq);
}

Now you only have to allocate the scalar once. The local block there is
just forcing garbage collection of @seq;

-Ian
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================