title: Non-defined return of sub
body: <p>How can I avoid that a variable gets touched by a return of a subfunction. I wrote following code snippet</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  
  my $a = "init";
  
  sub funct{
      my $var;
      #$var = 1;
      return $var if defined $var;
  }
  
  my $tmp = funct;
  
  $a = $tmp if defined $tmp;
  print "$a\n";
  </code></pre>
  
  <p>and I don't want the value of <code>$a</code> be changed from it's initial <code>init</code> if <code>$var</code> isn't defined in the subfunction.</p>
  
  <p>Where is the error or is there a better way to solve this problem?</p>
  
  <p>Greetings</p>