Help for this page

Select Code to Download


  1. or download this
    if ($answer=42) { # $answer is now always 42
        ...
    ...
        ...
    }
    
  2. or download this
    use Readonly;
    Readonly my $fortytwo => 42; # note: =>, not =
    ...
    if ($fortytwo=$answer) { # "Modification of a read-only value attempte
    +d"
        ...
    }
    
  3. or download this
    use constant FORTYTWO => 42; # note: =>, not =
    
    ...
    if (FORTYTWO=$answer) { # "Can't modify constant item in scalar assign
    +ment"
        ...
    }