i have recently started learning perl.....and having issues when i try to read input from another file. the details of a script that i tried to run are as follows:
i made a text file by the name "text.txt" and the contents wereThen i wrote the following scriptSidra|38|BE Hira|48|BE Shagufta|50|BE
the script produces no output and displays a message sayingopen(DAT, "text.txt"); $data_file=" text.txt "; open(DAT, $data_file); @raw_data=; close(DAT); foreach $student (@raw_data) { chomp($student); ($name,$roll_no,$class)=split(/\|/,$student); print "The student $name bearing roll number $roll_no is in class $cla +ss"; print " \n"; }
"readline () closed filehandle at line "
I tried the same with another file by the name "text.dat" holding the same data but it did not work either. Please help me out resolving this issue. Thankyou...In reply to reading input from a file by Hir@
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |