title: How can I get name of the user executing my Perl script?
body: <p>I have a script that needs to know what username it is run from.</p>
  
  <p>When I run it from shell, I can easily use $ENV{"USER"}, which is provided by bash.</p>
  
  <p>But apparently - then the same script is run from cron, also via bash - $ENV{"USER"} is not defined.</p>
  
  <p>Of course, I can:</p>
  
  <pre><code>my $username = getpwuid( $&lt; );
  </code></pre>
  
  <p>But it doesn't look nice - is there any better/nicer way? It doesn't have to be system-independent, as the script is for my personal use, and will be only run on Linux.</p>