Quick Search:
 
 Perl Code: Call subroutine and pass filehandle Jump to:  
Category: >> Perl Code >> Call subroutine and pass filehandle  

<< last 

Snippet Name: Call subroutine and pass filehandle

Description: Call a subroutine and pass a filehandle. Perl's typeglob comes to the rescue. The special * ("star") type symbol allows you to refer to filehandles as if they were scalars.

Comment: (none)

Language: PERL
Highlight Mode: PERL
Last Modified: March 06th, 2009

OPEN XM, "/path/to/some/file.txt";
 
print_file(*XM);
 
SUB print_file {
    MY $handle = SHIFT;
    WHILE (<$handle>) {PRINT};
}
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org