title: Passing a scalar reference in Perl
body: <p>I know that passing a scalar to a sub is actually passing the reference, but since I am new to perl I still did the following test:</p>
  
  <pre><code>#!/usr/bin/perl
  $i = 2;
  subr(\$i);
  sub subr{
      print $_[0]."\n";
      print $$_[0]."\n";
  }
  </code></pre>
  
  <p>I thought the first line is going to print an address and the second line is going to give be back the number, but the second one is a blank line. I was pointed by someone one else to do this: <code>${$_[0]}</code> and it prints the number. But she didn't know the reason why without {} it is not working and why it is working with {}. So what has happened?</p>