in reply to reading input from a file

Welcome to the monastery, the preview page explains how to mark up text so that it is formatted correctly, you should use <code> tags around your code like this, I have added a few, hopefully helpful, comments
use strict; # these two lines will save you use warnings; # endless head scratching open(DAT, "text.txt"); # you open this file again in two lines $data_file="<text.txt "; # three argument version of open is preferabl +e open(DAT, $data_file); # you should check the return value of open @raw_data=<DAT>; # Assumed this was what the line said 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"; }

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."