Closes a directory opened by C<opendir> and returns the success of that
system call.
-DIRHANDLE may be an expression whose value can be used as an indirect
-dirhandle, usually the real dirhandle name.
-
=item connect SOCKET,NAME
Attempts to connect to a remote socket, just as the connect system call
(The following is a comprehensive reference to open(): for a gentler
introduction you may consider L<perlopentut>.)
-If FILEHANDLE is an undefined lexical (C<my>) variable the variable is
-assigned a reference to a new anonymous filehandle, otherwise if
-FILEHANDLE is an expression, its value is used as the name of the real
-filehandle wanted. (This is considered a symbolic reference, so C<use
-strict 'refs'> should I<not> be in effect.)
+If FILEHANDLE is an undefined scalar variable (or array or hash element)
+the variable is assigned a reference to a new anonymous filehandle,
+otherwise if FILEHANDLE is an expression, its value is used as the name of
+the real filehandle wanted. (This is considered a symbolic reference, so
+C<use strict 'refs'> should I<not> be in effect.)
If EXPR is omitted, the scalar variable of the same name as the
FILEHANDLE contains the filename. (Note that lexical variables--those
Opens a directory named EXPR for processing by C<readdir>, C<telldir>,
C<seekdir>, C<rewinddir>, and C<closedir>. Returns true if successful.
+DIRHANDLE may be an expression whose value can be used as an indirect
+dirhandle, usually the real dirhandle name. If DIRHANDLE is an undefined
+scalar variable (or array or hash element), the variable is assigned a
+reference to a new anonymous dirhandle.
DIRHANDLEs have their own namespace separate from FILEHANDLEs.
=item ord EXPR
eval 'opendir(NOSUCH, "no/such/directory");';
if ($@) { print "1..0\n"; exit; }
-print "1..3\n";
+print "1..11\n";
for $i (1..2000) {
local *OP;
shift(@G);
}
if (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; }
+
+if (opendir($fh, "op")) { print "ok 4\n"; } else { print "not ok 4\n"; }
+if (ref($fh) eq 'GLOB') { print "ok 5\n"; } else { print "not ok 5\n"; }
+if (opendir($fh[0], "op")) { print "ok 6\n"; } else { print "not ok 6\n"; }
+if (ref($fh[0]) eq 'GLOB') { print "ok 7\n"; } else { print "not ok 7\n"; }
+if (opendir($fh{abc}, "op")) { print "ok 8\n"; } else { print "not ok 8\n"; }
+if (ref($fh{abc}) eq 'GLOB') { print "ok 9\n"; } else { print "not ok 9\n"; }
+if ("$fh" ne "$fh[0]") { print "ok 10\n"; } else { print "not ok 10\n"; }
+if ("$fh" ne "$fh{abc}") { print "ok 11\n"; } else { print "not ok 11\n"; }