<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!perl -w

	# adopt perl's path to your environment.
	
	use strict;
	use Data::Iterator;                 # assuming you put it into	
	                                    # your [site/]lib/Data-		
	                                    #directory					

	# Create a datastructure:
    my %data  = (a =&gt; 1,
                 b =&gt; [ qw(b1 b2 b3) ],
                 c =&gt; {c1 =&gt; sub {return qw(first second third)},
                       c2 =&gt; undef,
                       c3 =&gt; 'val_of_c3'
                      }
                );

    ## Create an Iterator-object:
    my $dobj = new Data::Iterator (\%data)
         || die "Oops. Creation of Iterator-object failed: $!";

    ## Now let's get all the names + values...
   while (my ($path, $val) = $dobj-&gt;element) {
      print "all data: path: $path, value: $val\n";
      # or whatever is to be done with $path, $val :-)
    }
    # ...and prepare for a new loop, if necessary:
    $dobj-&gt;reset;
    # ...

    ## Lookup data in $data{'c'}...
    while (my ($path, $val) = $dobj-&gt;element('{c}*')) { # note the asterisk!
      print "just {c}: path: $path, value: $val\n";
      # or whatever is to be done with $path, $val :-)
    }
    # ...and prepare for a new loop, if necessary:
    $dobj-&gt;reset('{c}');
    # ...

    ## Just retrieve a single value...
    my $distinct_val   = $dobj-&gt;element ('{b}[1]');

    ## ...or set a value (autovivificates data element, if necessary)
    my $old_val_of_b_1 = $dobj-&gt;element ('b.1', 'A New Value!');

	# Now let's get all the keys:
	print "\nKeys:   \n", join "\n", $dobj-&gt;keys;
	
	# ...and the values:
	print "\nValues: \n", join "\n", $dobj-&gt;values;

    ## Lookup a file's content...
    my $fobj = new Data::Iterator ('-FILE:C:\path\to\file.ext')
         || die "Oops. Creation of Iterator-object failed: $!";
    while (my ($path, $val) = $dobj-&gt;element) {
      print "path: $path, value: $val\n";
      # or whatever is to be done with $path, $val :-)
    }

    ## ...OR:
    open (FH, '&lt; C:\path\to\file.ext')
         || die "Oops. Could not open file: $!";
    $fobj = new Data::Iterator (\*FH)
         || die "Oops. Creation of Iterator-object failed: $!";
    # ...</pre></body></html>