I'm looking for a little help here. I'm not understanding exactly what's wrong with this code:

===============================================================
#!/usr/bin/perl -w

use strict;

open IN, "<comma.txt" or die "$!\n";

my %rows;

while (<IN>)
{
    chomp;
    my @fields = split( /,/, $_);
    $rows{$fields[2]} = [ ($fields[3]..$fields[-1]) ];
    print "array: ";
    print "@{$rows{$fields[2]}}\n";
}

close IN;
===========================================================

This prints nothing for the array. If I replace the scalars inside [ () ] with literal strings or numbers it works. What the correct way to do what I'm attempting. Am I just quoting wrong?

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to