in reply to Crazy Golf : creating hex ranges from non-consecutive hex data values
my @hexv; while (<DATA>) { chomp; my @vals = split ' ', $_; @hexv = (@hexv,@vals) }
@hexv = (@hexv,@vals) Really!? Haven't you heard of push?
And it doesn't have to be that complicated:
my @hexv; while (<DATA>) { push @hexv, split; }
Or even:
my @hexv = map split, <DATA>;
my $endex = scalar @hexv - 1;
More correctly written as:
my $endex = $#hexv;
foreach my $index ( 0 .. $endex ){ last if $index == $endex;
Why not just:
foreach my $index ( 0 .. $endex - 1 ){
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Crazy Golf : creating hex ranges from non-consecutive hex data values
by zentara (Cardinal) on Aug 01, 2011 at 13:36 UTC | |
|
Re^2: Crazy Golf : creating hex ranges from non-consecutive hex data values
by Anonymous Monk on Aug 01, 2011 at 05:11 UTC | |
by jwkrahn (Abbot) on Aug 01, 2011 at 05:29 UTC |