Help for this page

Select Code to Download


  1. or download this
    p2@nereida:~/src/perl/testing$ cat precedence1.pl
    my $n1 = 2;
    my $n2 = 4;
    print "$n1 plus $n2 is " . $n1 + $n2 . "\n";
    
  2. or download this
    pp2@nereida:~/src/perl/testing$ perl precedence1.pl
    6
    
  3. or download this
    pp2@nereida:~/src/perl/testing$ cat precedence2.pl
    use warnings;
    my $n1 =2;
    my $n2 = 4;
    print "$n1 plus $n2 is " . $n1 + $n2 . "\n";
    
  4. or download this
    pp2@nereida:~/src/perl/testing$ perl precedence2.pl
    Argument "2 plus 4 is 2" isn't numeric in addition (+) at precedence2.
    +pl line 6.
    6
    
  5. or download this
    pp2@nereida:~/src/perl/testing$ perl -MO=Deparse,-p precedence2.pl
    use warnings;
    ...
    (my $n2 = 4);
    print(((("$n1 plus $n2 is " . $n1) + $n2) . "\n"));
    precedence2.pl syntax OK
    
  6. or download this
    (((("$n1 plus $n2 is " . $n1) + $n2) . "\n"))