in reply to plotting roc curve using roc package

Hmmm, you probably want this:
while ( <fh> ) { ($a,$b)=split/,/; push @AoA, [ $a, $b ]; }
Update: you also probably need to chomp your data lines.

Replies are listed 'Best First'.
Re^2: plotting roc curve using roc package
by GrandFather (Saint) on Aug 02, 2015 at 08:11 UTC

    Hmmmm, no he probably doesn't want that.

    $a and $b are special variables and even in sample code should be avoided. In fact more effort should go into making sample code clean and clear than even production code because you are providing example code for other people. You could write your sample like:

    while (<$fh>) { my ($value, $truth) = split /,/; push @groups, [$value, $truth]; }

    which hints at using lexical file handles, avoids special variables, uses correctly scoped sensibly named lexical variables and uses consistent white space.

    Update: replaced ) with ] - thanks Laurent_R

    Premature optimization is the root of all job security
      Hum, yes, GrandFather, you're right, I wouldn't write such code, but here I only wanted to point to the obvious error in the code shown, i.e. that the first split was useless (because the result is never used) and that the second split did not split anything but probably only removed trailing spaces and newline character from $_. But you're right that the OP should use strictures and warnings, should not use the $a and $b special variables, should use meaningful variable names, and so on.