Tag: Perl

Perl Code Snippets

Perl Search for Files and Directories Perl Remove Directory Perl Extract File and Directory Names from Full Paths Perl Copy File Perl Command Line Options Perl Environment Variables Perl Check File Exists Perl Get User Input Perl Upper Case Perl String Comparison Perl Exit Error Perl Get Number of Lines of an Array Perl Change

Perl return undef

Question In Perl what is the difference between return and return undef Answer Using “return” alone returns an empty list in list context and undef in scalar context. On the other hand “return undef” always returns undef even in list context. Generally speaking it is not a good idea to return undef from a subroutine