Hmmm, Im trying to learn a few programming languages for the summer and im starting out with PERL because.
1) Someone in IRC reccommended it to me and
2) Its a good language to start on.
Anyway, on to my problem... In the tutorial on PERL that I am reading I have to code a program to open a file, print the contents into an array and the print out the contents of that file so that every line has a prefix of #... The code I have so far is:
But when I run the file the text from the /root/perl/food file doesnt show at all, and when it did show it only the first line had the prefix of # (I understand that !#/usr/bin/perl already has a #, before it had 2)Code:#!/usr/bin/perl # # $file = '/root/perl/food'; open(INFO, $file); @lines = <INFO>; close(INFO); print ( "#", @lines);




Reply With Quote