Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:>perl opendir.pl $file = \'.'; # This is '.' at opendir.pl line 12. @_ = ( # Your sub get an array containing '.' '.' ); at opendir.pl line 18. $line = \1; # but $line is 1 (the length of @_) ... at opendir.pl line 20. # what you really wanted is my ($filename) = @_; # This is the name of the file that needs to be opened/read/closed 0 $file = \'..'; at opendir.pl line 12. @_ = ( '..' ); at opendir.pl line 18. $line = \1; at opendir.pl line 20. 0 $file = \'MyOpen(0).pl'; at opendir.pl line 12. @_ = ( 'MyOpen(0).pl' ); at opendir.pl line 18. $line = \1; at opendir.pl line 20. 0 ...