You have an extra angle bracket. Should be:
open (INFILE, "<moo.cgi"); Also okay is: open (INFILE, "moo.cgi"); >> means append. < means read. << is just confusing... ;-) ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 11, 2002 1:16 PM Subject: This Simple program won't work - why? > > I am a total beginner to perl. I wrote the program below to open a program > file, read it line by line, and write each line to an output file after > first putting two string lines out there. It compiles without errors but the > output is a filename with zero length. What did I do wrong? Thank you! > > > #!/usr/bin/perl -w > use strict; > > open (infile, "<<moo.cgi"); > open (outfile, ">>snert.cgi"); > > my @linesin = <infile>; > > foreach (@linesin) { > > print outfile "output line 1\n"; > print outfile "output line 2\n"; > print outfile "$_\n"; > > } > > close (infile); > close (outfile); > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]