my @decoded = unpack '...', substr $bigscalar, $offset, $size;
substr $bigscalar, $offset, $size, pack '...', @newValues;
# or
substr( $bigscalar, $offset, $size ) = pack '...', @newValues;
####
my $replacement = pack '...', @newValues;
substr( $bigScalar, $offset, length $replacement ) = $replacement;
##
##
## Create a scalar
perl> $bigScalar = 'the quick brown fox jumps over the laxy dog';;
## Create an array of lvalue refs to the indivdual words using \substr...
perl> @lvrefs = map{
\substr $bigScalar, $_->[0], $_->[1]
} [0,3], [4,5], [10,5], [16,3], [20,5], [26,4], [31,3], [35,4], [40,3];;
## Indirecting through the elements of the array gives you the words
perl> print $$_ for @lvrefs;;
the
quick
brown
fox
jumps
over
the
laxy
dog
## And assign through the elements allows you to replace them, in-place, individually
perl> ${ $lvrefs[7] } = 'lazy';; ## The ${ ... } is necessary.
## The typo is now corrected.
perl> print $bigScalar;;
the quick brown fox jumps over the lazy dog