Look at the following code, which is an analog of what you have posted.
When I run that I get:#!/usr/bin/perl -w ###################################################################### +## use strict; my $file=$0; my $line=1; open(FH,"$file") or die $!; print "Content-type: text/plain\n\n\n"; while (<FH>) { printf "%d:%s",$line++,<FH>; }
--$ ./filetest.pl Content-type: text/plain 1:#################################################################### +#### --$
To fix this I do the following:
Which yields:#!/usr/bin/perl -w ###################################################################### +## use strict; my $file=$0; my $line=1; open(FH,"$file") or die $!; print "Content-type: text/plain\n\n\n"; while (<FH>) { printf "%d:%s",$line++,$_; # $_ vs. <FH> }
Which I believe is more what you wanted.--$ ./filetest.pl Content-type: text/plain 1:#!/usr/bin/perl -w 2:#################################################################### +#### 3: 4:use strict; 5: 6:my $file=$0; 7:my $line=1; 8: 9:open(FH,"$file") or die $!; 10: 11:print "Content-type: text/plain\n\n\n"; 12:while (<FH>) { 13: printf "%d:%s",$line++,$_; 14:} --$
Yeah... I know the close(FH) is missing at the end.
| Peter L. Berghold | Brewer of Belgian Ales |
| Peter@Berghold.Net | www.berghold.net |
| Unix Professional | |
In reply to Re: Re: code problem
by blue_cowdawg
in thread code problem
by sandal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |