Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    print diff(shift)."\n";
    ...
        return diff($1)."+".diff($2) if m/(.+?)\+(.+);
        ... # other differentiation rules here
    }
    
  2. or download this
    ...
    if (m/(.+?)\+(.+))
    my $firstTerm = $1;
    my $secondTerm = $2;
    return diff($firstTerm)."+".diff($secondTerm);
    
  3. or download this
    sub diff
    {
        my $_=shift; my $1; my $2;
        ...
    }
    
  4. or download this
    Can't use global $1 in "my"...
    Execution ... aborted due to compilation errors.