
ragha12
Novice
Sep 22, 2011, 9:39 PM
Post #1 of 2
(943 views)
|
|
Read only one line from text file
|
Can't Post
|
|
Hi, I am using strawberry perl in windows and perl express IDE I have a text file that contains 10 lines, i have to print only 1 line from that text file......and we have to use only while loop...... this is the code that i have..... this code is printing all the lines.... #!/usr/bin/perl open (MYFILE, 'dmb.txt'); while (<MYFILE>) { chomp; print "$_"; } close (MYFILE); Thank you...
|