Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Perl >> Snippet

loop through a file


open (SOURCE, "text.txt" )
while ( < SOURCE > )               # without condition, file is read one line at a time til EOF
     { chomp ; print ; }         # each line is put into $_. chomp/print operate on $_
close (INPUT)
print ' \n .. Done!' ;