Catmandu::Fix::add_field(3pm)

Catmandu::Fix::add_field3pm

Add or change the value of a hash key or array index

Usage

   # Add a new field 'foo' with value 2
   add_field(foo, 2)
   # Change the value of 'foo' to 'bar 123'
   add_field(foo, 'bar 123')
   # Create a deeply nested key
   add_field(my.deep.nested.key, hi)
   # If the second argument is omitted the field has a null value
   add_field(foo)

Overview

Contrary to "set_field", this will create the intermediate structures if they are missing.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.