Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


More on LinuxToday


Linux Magazine: Filehandle References [in Perl]

Jun 04, 2000, 12:13 (0 Talkback[s])
(Other stories by Randal L. Schwartz)

"In the past two columns, I looked at using references in Perl and showed the basic syntax for creating references to arrays, hashes, scalars, and subroutines. I also described the canonical form of converting a non-reference expression into a reference, and how to use the shortcut rules to make this simpler."

"Let's take a look now at filehandles and directory handles. These handles let us look at or talk to the "outside world," a worthwhile endeavor if we want our program to have some permanent impact on the computing environment."

"First, recall that a filehandle doesn't really have a syntax to make it a full-fledged variable. You can't assign it, use it (directly) with local() or my(), pass it to or from a subroutine, or store it into a data structure. What does that leave? Well, there are about a dozen operations that use a filehandle or a directory handle, specified by a bareword (an alphanumeric symbol sequence separated by double colons, like STDIN or MyPack::Output)."

Complete Story

Related Stories: