Yes, PDL::Core (the base class of PDL::Char) overloads almost all, if not all, the basic perl operators so that operations between pdl objects will return a relevant pdl object. This includes operations like != and +.

Just look at this clip of source for PDL::Core to see the complete list:

use overload ( "+" => \&PDL::plus, # in1, in2 "*" => \&PDL::mult, # in1, in2 "-" => \&PDL::minus, # in1, in2, swap if true "/" => \&PDL::divide, # in1, in2, swap if true "+=" => sub { PDL::plus ($_[0], $_[1], $_[0], 0); $_[0] +; }, # in1, in2, out, swap if true "*=" => sub { PDL::mult ($_[0], $_[1], $_[0], 0); $_[0]; }, + # in1, in2, out, swap if true "-=" => sub { PDL::minus ($_[0], $_[1], $_[0], 0); $_[0] +; }, # in1, in2, out, swap if true "/=" => sub { PDL::divide ($_[0], $_[1], $_[0], 0); $_[0] +; }, # in1, in2, out, swap if true ">" => \&PDL::gt, # in1, in2, swap if true "<" => \&PDL::lt, # in1, in2, swap if true "<=" => \&PDL::le, # in1, in2, swap if true ">=" => \&PDL::ge, # in1, in2, swap if true "==" => \&PDL::eq, # in1, in2 "eq" => \&PDL::eq, # in1, in2 "!=" => \&PDL::ne, # in1, in2 "<<" => \&PDL::shiftleft, # in1, in2, swap if true ">>" => \&PDL::shiftright, # in1, in2, swap if true "|" => \&PDL::or2, # in1, in2 "&" => \&PDL::and2, # in1, in2 "^" => \&PDL::xor, # in1, in2 "<<=" => sub { PDL::shiftleft ($_[0], $_[1], $_[0], 0); $_[0 +]; }, # in1, in2, out, swap if true ">>=" => sub { PDL::shiftright($_[0], $_[1], $_[0], 0); $_[0 +]; }, # in1, in2, out, swap if true "|=" => sub { PDL::or2 ($_[0], $_[1], $_[0], 0); $_[0] +; }, # in1, in2, out, swap if true "&=" => sub { PDL::and2 ($_[0], $_[1], $_[0], 0); $_[0] +; }, # in1, in2, out, swap if true "^=" => sub { PDL::xor ($_[0], $_[1], $_[0], 0); $_[0 +]; }, # in1, in2, out, swap if true "**=" => sub { PDL::power ($_[0], $_[1], $_[0], 0); +$_[0]; }, # in1, in2, out, swap if true "%=" => sub { PDL::modulo ($_[0], $_[1], $_[0], 0); +$_[0]; }, # in1, in2, out, swap if true "sqrt" => sub { PDL::sqrt ($_[0]); }, "abs" => sub { PDL::abs ($_[0]); }, "sin" => sub { PDL::sin ($_[0]); }, "cos" => sub { PDL::cos ($_[0]); }, "!" => sub { PDL::not ($_[0]); }, "~" => sub { PDL::bitnot ($_[0]); }, "log" => sub { PDL::log ($_[0]); }, "exp" => sub { PDL::exp ($_[0]); }, "**" => \&PDL::power, # in1, in2, swap if true "atan2" => \&PDL::atan2, # in1, in2, swap if true "%" => \&PDL::modulo, # in1, in2, swap if true "<=>" => \&PDL::spaceship, # in1, in2, swap if true "=" => sub {$_[0]}, # Don't deep copy, just copy + reference ".=" => sub {my @args = reverse &PDL::Core::rswap; eval { PDL::Ops::assgn(@args); }; if ($@) { # Remove references to this (and deeper) # code before rebarfing: $@ =~ s/\s*at .* line \d+\s*\.\n*/./; $@ =~ s/PDL:\s+//g; $@ =~ s/\s*Caught at .* pkg .+\n+//; PDL::Core::barf("Problem with assignment: +$@"); } return $args[1]; }, 'x' => sub{my $foo = $_[0]->null(); PDL::Primitive::matmult(@_[0,1],$foo); $foo;}, 'bool' => sub { return 0 if $_[0]->isnull; croak("multielement piddle in conditional expression" +) unless $_[0]->nelem == 1; $_[0]->clump(-1)->at(0); }, "\"\"" => \&PDL::Core::string ); }

In reply to Re^3: PDL: string comparison to binary piddle by wind
in thread PDL: string comparison to binary piddle by umeboshi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.