another question on this...I have the loop in place, but it still
prints the entire file to the screen...not the specified number of
lines...hmmmmph!
$j = 0;
while ($j < 10) {
while ( $line = <THATFILE>) {
print "$line\n";
$j++;
}
}
CTP
#!/usr/bin/perl
opendir ( CURRDIR, '' ) || die "Can't open it!";
@file_list = readdir ( CURRDIR );
$i = 0;
foreach $file_name ( @file_list ) {
print "$i - $file_name\n";
$i ++;
}
print "Which file would you like to open?: ";
chomp ( $openme = <STDIN> );
print "I will open $file_list[$openme]\n";
open (THATFILE , $file_list[$openme] || die "can't open $file_list[$openme]");
#where does the script exit?
#print "hey...I got this far 1\n";
$j = 0;
while ($j < 10) {
while ( $line = <THATFILE>) {
print "$line\n";
$j++;
}
}
#where does the script exit?
#print "hey...I got this far 2\n";
close (THATFILE);
closedir CURRDIR;