in reply to Re: Delete reference tree from a file
in thread Delete reference tree from a file

My bad ...typo error its servername.com

  • Comment on Re^2: Delete reference tree from a file

Replies are listed 'Best First'.
Re^3: Delete reference tree from a file
by hippo (Archbishop) on Mar 27, 2018 at 13:54 UTC

    So, just delete that then.

    use strict; use warnings; use Test::More tests => 2; my $ref = { 'servername.com' => 'foo' }; ok (defined $ref->{'servername.com'}, 'Present'); delete $ref->{'servername.com'}; ok (!defined $ref->{'servername.com'}, 'Absent');

      Thanks for the input... but here the status file contains the reference, and this has to be deleted from the file.

        The algorithm in full:

        1. Read the data from the file into a hashref.
        2. Delete the entries as desired.
        3. Write the hashref back to the file.