CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [GeneticsGirl] Help outputting first and last positions of blocks of the same type: Edit Log



Laurent_R
Veteran / Moderator

Aug 23, 2012, 1:37 PM


Views: 3529
Re: [GeneticsGirl] Help outputting first and last positions of blocks of the same type

Hi Heather,

a few things that will make your code simpler.

To start with, use the following pragmas:


Code
use strict; 
use warnings;


That will give you a lot of indications on possibly wrong code.

Second, your long list of declarations could be simplified:


Code
my $pos; 
my $V_GT;
my $I_GT;
my $type;
# ...
}

into:


Code
my ( $pos,  $V_GT,  $I_GT, $type @array, ...};


This:

Code
while (<FILE>){ 
my $line = $_;
chomp $line;

@array = split (/\s/, $line);


could be rewritten as follows:


Code
while (<FILE>){ 
chomp;
@array = split;


@array is a poor name for an array. Try instead to use a name that correspond to the contents.

I do not have time right now to suggest a proper algorithm, but if that can wait for the weekend, I guess I could supply you with the basis of what you need.


(This post was edited by Laurent_R on Aug 23, 2012, 1:41 PM)


Edit Log:
Post edited by Laurent_R (Veteran) on Aug 23, 2012, 1:41 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives