Code:
#!/usr/local/bin/perl-w
use strict;
use diagnostics;
# Program to open the password file, read it in,
# print it, and close it again.
my $file = '/etc/passwd'; # Name the file
open(INFO, $file); # Open the file
my @lines = <INFO>; # Read it into an array
close(INFO); # Close the file
#print @lines; # Print the array
foreach $morsel (@food) # Visit each item in turn
# and call it $morsel
{
print "$morsel\n"; # Print the item
print "Yum yum\n"; # That was nice
}
output:
Global symbol "$morsel" requires explicit package name at test line 14.
Global symbol "@food" requires explicit package name at test line 14.
Global symbol "$morsel" requires explicit package name at test line 17.
Execution of test aborted due to compilation errors (#1)
Uncaught exception from user code:
Global symbol "$morsel" requires explicit package name at test line 14.
Global symbol "@food" requires explicit package name at test line 14.
Global symbol "$morsel" requires explicit package name at test line 17.
Execution of test aborted due to compilation errors.
whats wrong with the program ?
i followed the instruction from the tutorial. still its giving error . i am not able to understand this error message.