use file_read; my $a=0; while(){ $a+=1; } print "$a"; #### package file_read; while(){ print; } 1; #### perl fileread.pl