in reply to Re: Modification of read-only value error when using closure
in thread Modification of read-only value error
I was under the impression that args are sent as values through @_ and thought that this problem was something to do with closures. I went back and tried a chomp on simple sub and the same happened. I checked perldoc perlsub and i got this info
Any arguments passed in show up in the array @_. Therefore, if you ca +lled a function with two arguments, those would be stored in $_[0] an +d $_[1]. The array @_ is a local array, but its elements are aliases + for the actual scalar parameters. In particular, if an element $_[0 +] is updated, the corresponding argument is updated (or an error occu +rs if it is not updatable).
Now it is clear to me!
thanks again!
cheers
SK
|
|---|