http://www.perlmonks.org?node_id=1019009


in reply to Deletes All Records not just one

The code as shown is not deleting any records. Also, the filehandle DAT is opened for writing, but never closed: close $output; should be close DAT;. But I suspect the real problem is in the line:

next if ($field[1], $field[2]) = ($delroadName, $delroadNumber);

Perhaps you meant:

next if $field[1] eq $delroadName && $field[2] == $delroadNumber;

Note that = is for assignment. To test for equality, == is used for numbers, and eq for strings.

Also note that $field[1] is the second field, as arrays start from element zero. (Your code may be correct here — I only mention this as a point to double-check.)

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,