use constant FORTYTWO => 42; # note: =>, not = ... if (FORTYTWO=$answer) { # "Can't modify constant item in scalar assignment" ... }