Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    use Data::Dumper;
    
    my $original = '{"OWNER":"KeyProjects","age1":null,"ht1":null}';
    
  2. or download this
    my $data = decode_json($original);
    print Dumper $original;
    print Dumper $desired;
    print Dumper $data;
    for my $key ( keys % {$data}  )
    
  3. or download this
    {
        print "Found a key: $key", $/;
        if ( $key =~ /\A (?: age\d+ | ht\d+ ) \z/x )
    ...
            print "  -> It matches our regular expression\n";
            print "  -> Deleting it from data structure\n";
            my $value = delete $data->{$key};
    
  4. or download this
            print Dumper $key;
    
  5. or download this
            print Dumper $value;
    
  6. or download this
            print "  -> Putting it back under sub-structure with key 'sche
    +duled'\n";
            $data->{scheduled}{$key} = $value;
    
  7. or download this
            print Dumper $key;
            print Dumper $value;
    ...
    my $desired_data = decode_json( $desired );
    is_deeply( $desired_data, $data, "Data structures match" );
    done_testing(1);