Hi,

(Please don't just reply to a list message if you are starting a new subject 
or thread.)

In article <[EMAIL PROTECTED]>, Sitha Nhok wrote:

> Hi,
> 
> I was wondering if someone could help me with a problem I am having.
> 
> I have a two dimensional array, but I would like to delete an entire
> row.  What is the most efficient way of doing that?  I tried using
> splice, but it only shrinks the number of cols and it doesn't get rid of
> the entire row.  Any ideas?  Thanks in advance.

Splice worked for me, but who knows if I understood your question...

#!/usr/bin/perl
use warnings;
use strict;

# del_row_in _AoA
# two-dimensional array - how to delete an entire row?

use Data::Dumper;

my @AoA = (
           ["A1","A2","A3","A4","A5"],
           ["B1","B2","B3","B4","B5"],
           ["C1","C2","C3","C4","C5"],
           ["D1","D2","D3","D4","D5"],
           ["E1","E2","E3","E4","E5"],
           );

print "Removing second line: ", @{ $AoA[1] }, "\n";
splice @AoA, 1, 1;
print Dumper([EMAIL PROTECTED]);

##

Maybe you have instead a ref to an array of arrays instead of an array of 
array references? (Never thought I'd understand the diff.) That would just 
change the syntax a little I believe (but would have to try it).

-K


-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to