[Pdx-pm] array question

aspen 108 aspen_108 at hotmail.com
Mon Apr 21 15:23:04 CDT 2003

Hi Ovid-

Thanks for the note.  I will give your snippet a try.

Here're some parts of the code where I'm running into the problem.  Be 
forewarned, I'm kind of a perl newbie...

Here's the part where I'm reading the data into these arrays:

    if ($get_temp == 1 && $inp_line !~ /Temperature/) {
        @temp_array = split ' ', $inp_line;
        for $temp_data (@temp_array) {
            $temp[$seg][$lay] = $temp_data;
            printf "%s%10.1f%10.1f%8.2f%8.2f%8.1f\n", $reg_date, $seg, $lay, 
$temp[$seg][$lay], $tot_seg, $#{$temp[$seg]};

Here's one example of how I'm trying to clear the array:

        for ($seg = $#temp; $seg > 0; $seg--) {
            for ($lay = $#{$temp[$seg]}; $lay > 0; $lay--) {
                undef $temp[$seg][$lay];

That print statement with the $#{$temp[$seg]} lets me look at the index as 
it runs, and the array indices are not being cleared with the undef.  I gave 
your one suggestion "@some_array = ();" a quick try, but that didn't clear 
the indices either... not sure if there's a different syntax for a 2-d array 

Thank you for your help,

Annett :)

The new MSN 8: advanced junk mail protection and 2 months FREE*  

More information about the Pdx-pm-list mailing list