for ('23') { /2/ and process($0); /3/ and finalize(); } #### Modification of a read-only value attempted at ./test.pl line 9. #### for my $switch ($runlvl) { $switch =~ /2/ and process($0); $switch =~ /3/ and finalize(); }