Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
File I/O overwrite array variables?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="jamesrwagner, post: 4846552"] Hello: I was basically finding that after a block of code, an array I had called @localizations was still the same size, but each of the variables was now being overwritten by an empty string. What I found on closer inspection was that as I was reading in from the file with handle INPUT, each line was in turn being stored in the current place that it was on from the outer foreach loop, until upon termination when the final line is only a newline storing a n empty string in that place holder. The code below sub indexSequences { my $fold = shift; my $minSup = shift; my @localizations = ("cytoplasmic", "cytoplasmicmembrane", "extracellular", "outermembrane", "periplasmic"); my %containsHash; foreach(@localizations) { my $localization = $_; open INPUT, "freseqs" . $_ . $fold . $minSup ; while(<INPUT>) { chomp; } foreach(@localizations) { my $alocalization = $_; print("This is the $alocalization $_\n"); } } } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
File I/O overwrite array variables?
Top