title: Getting classname of a object in Perl
body: <p>I have an object reference and it could be a reference to an object of type 'FooInvalidResults'</p>
  
  <p>There is a file called FooInvalidResults.pm and there is a line 'package FooInvalidResults' in it.</p>
  
  <p>will the following work?</p>
  
  <pre><code>my $class = blessed $result;
  if ($class eq 'FooInvalidResults') {
    # do something
  } else {
    # do something else
  }
  </code></pre>