in reply to Feedback Appreciated on text-parsing, SQL querying subroutine

Hi

I would like to notify some points to you, from your code.

unless (open(INPUT, "$inputfile")) { print "ERROR: Can't open file for reading : $!\n"; }
If there is any error in opening the file Just you are printing the error message and continuing the code with
while ( <INPUT> ).

How can you do that ?
Is that mandatory in your code? Just think it off on that.
# splitting on tab character my @data = split("\t", $_); # assigning varables my $did1 = $data[0]; my $did2 = $data[1]; my $score1 = $data[2]; my $score2 = $data[3];
The above code can be written as
my ( $did1,$did2,$score1,$score2 ) = (split("\t", $_))[0..3];

"Keep pouring your ideas"

Replies are listed 'Best First'.
Re^2: Feedback Appreciated on text-parsing, SQL querying subroutine
by saberworks (Curate) on May 31, 2006 at 19:25 UTC
    The above code can be written as my ( $did1,$did2,$score1,$score2 ) = (split("\t", $_))[0..3];
    As a curiousity, how come you are subscripting split? Split returns a list, so he should be safe with just...
    my ($did1, $did2, $score1, $score2) = split("\t", $_);
    Right?
    A reply falls below the community's threshold of quality. You may see it by logging in.