- or download this
while (<INFILE>) {
$word = <STDIN>;
...
# Officiate is asked for input on every line of the file.
# Officiate throttles monk; blacking out, you meditate on your error.
- or download this
while (<INFILE>) {
$line = $_;
...
# $line only contains the last line of the file!
# Officiate makes bad decision based on wrong output.
# Monk goes hungry.
- or download this
while (<INFILE>) {
push @lines, $_;
...
# File data is stored until $word is known.
# Officiate gets correct output, is pleased while file is small.
# Monk is thrashed when the disk thrashes on a large file.
- or download this
$word = <STDIN>;
while (<INFILE>) {
...
# There is no need to store the file data.
# Harmony is achieved.
- or download this
#!/usr/bin/perl -W
use warnings 'all';
...
}
my $key = pretty($type);
print @{ $lines{$key} };