kikuchiyo has asked for the wisdom of the Perl Monks concerning the following question:
The program
perl -le 'for my $x (1) {$x = pack "I", $x}'produces the warning "Modification of a read-only value attempted at -e line 1". But why? Where is the read-only value?
For contrast, perl -le 'for my $x (0..1) {$x = pack "I", $x}' doesn't warn.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Modification of a read-only value attempted?!?
by Bod (Parson) on Jan 07, 2024 at 20:49 UTC | |
by kikuchiyo (Hermit) on Jan 07, 2024 at 21:07 UTC | |
by haj (Vicar) on Jan 07, 2024 at 21:27 UTC | |
by LanX (Saint) on Jan 07, 2024 at 22:10 UTC | |
by jo37 (Curate) on Jan 07, 2024 at 20:57 UTC | |
by ikegami (Patriarch) on Jan 09, 2024 at 19:39 UTC | |
|
Re: Modification of a read-only value attempted?!?
by ikegami (Patriarch) on Jan 09, 2024 at 19:45 UTC |