Modification of a read-only value attempted at TradeExtract.pl line 103 (#1) (F) You tried, directly or indirectly, to change the value of a constant. You didn't, of course, try "2 = 1", because the compiler catches that. But an easy way to do the same thing is: sub mod { $_[0] = 1 } mod(2); Another way is to assign to a substr() that's off the end of the string. Uncaught exception from user code: Modification of a read-only value attempted at TradeExtract.pl line 103.