title: Can Perl detect arrays?
body: <p>I have this script</p>
  
  <pre><code>#!/usr/bin/perl
  
  use warnings;
  use strict;
  use Data::Dumper;
  
  my %x1 = ();
  $x1{"a"} = "e";
  
  my %x2 = ();
  $x2{"a"} = ["b","c"];
  
  p(\%x1);
  p(\%x2);
  
  sub p {
      my $x = shift @_;
      print $x-&gt;{a};
      print "\n";
  }
  </code></pre>
  
  <p>which outputs</p>
  
  <pre><code>e
  ARRAY(0x2603fa0)
  </code></pre>
  
  <p>The problem is I don't know when the input is an array or a scalar, and when it is an array I would like to print those values as well.</p>
  
  <p>Can <code>p</code> be modified to do this?</p>