Rob Benton <[EMAIL PROTECTED]> wrote:
: 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]) ];
I assume you really want:
$rows{ $fields[2] } = [ @fields[ 3 .. $#fields ] ];
Assuming @fields contains ( 7, 6, 4, 3, 2, 1 ), what you
are asking for is: "$rows{4} = [ (3..1) ];" which won't print
anything.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>