$ usr/perlbrew/perls/5.10t/bin/perl -Mv5.10 -e' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' File: # If not running interactively, don't do anything Dir: .gitconfig $ usr/perlbrew/perls/5.10t/bin/perl -Mv5.10 -we' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' Opening filehandle FOO also as a directory at -e line 3. File: # If not running interactively, don't do anything Dir: .gitconfig $ usr/perlbrew/perls/5.12t/bin/perl -Mv5.10 -e' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' Opening filehandle FOO also as a directory at -e line 3. File: # If not running interactively, don't do anything Dir: .gitconfig $ usr/perlbrew/perls/5.24t/bin/perl -Mv5.10 -e' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' Opening filehandle FOO also as a directory at -e line 3. File: # If not running interactively, don't do anything Dir: .python_history $ usr/perlbrew/perls/5.26t/bin/perl -Mv5.10 -e' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' Opening filehandle FOO also as a directory. This will be a fatal error in Perl 5.28 at -e line 3. File: # If not running interactively, don't do anything Dir: .gitconfig $ usr/perlbrew/perls/5.28t/bin/perl -Mv5.10 -e' open FOO, "<", ".bashrc" or die $!; opendir FOO, "." or die $!; print "File: ", scalar( ); say "Dir: ", scalar( readdir( FOO ) ); ' Cannot open FOO as a dirhandle: it is already open as a filehandle at -e line 3.