hi, who can tell me which is better of the following codes?
why there are different methods to read files?
thanks
1. open(INPUT, "< filedata") or die "Couldn't open filedata for reading:
$!\n";
while (<INPUT>) {
print if /blue/;
}
close(INPUT);
2. use IO::File;
$input = IO::File->new("< filedata")
or die "Couldn't open filedata for reading: $!\n";
while (defined($line = $input->getline())) {
chomp($line);
STDOUT->print($line) if $line =~ /blue/;
}
$input->close();
--
**********************************************
** Happy Everyday **
**********************************************