| .PerlSetHash {RSPerl} | R Documentation |
These functions allow one to set the values
of one more elements of a Perl array or table.
They underly the convenience methods
for assigning values to a
PerlArrayReference
and PerlHashReference
of the form
x[1] <- "a"
and
x["a"] <- 1
.PerlSetHash(ref, ..., value) .PerlSetArray(ref, ..., value)
ref |
the Perl object reference which should be
a PerlHashReference or
PerlArrayReference for
.PerSetHash and .PerlSetArray
respectively. |
... |
values identifiying
the elements of the array (as integers)
or hash-table (as strings) for
.PerSetHash and .PerlSetArray
respectively.
|
value |
the value to be assigned to the elements of the Perl array or table. |
This converts the values and the element identifiers to Perl and resolves the Perl reference there and then takes the appropriate action.
The object value so that it can
used in linked assignments
of the form
x <- y <- .PerlSetHash(ref, 1, value="Foo")
Duncan Temple Lang
http://www.omegahat.org/RSPerl
.PerlGet
.PerlGetArray
.PerlGetHash
# Manipulation of an array a <- .PerlNewArray() .PerlSetArray(a, 1, value="Test") .PerlGetArray(a) a[1] a[1] <- "Again" a[1] a[2] <- "Foo" # Manipulation of a Hash table. tb <- .PerlNewTable() .PerlSetHash(tb, "a", value="Test") .PerlSetHash(tb, "b", value="Again") .PerlGetTable(tb) tb["c"] <- "Another" tb["c"]