Could someone please tell me why this code doesn't work?
----- begin "line.pl" -----
#!/usr/bin/perl
# output i'm expecting:
#
#-----begin-----
#foreach $outerline (<FIN>)
#{
# if ($outerline =~ /outerline/)
# {
# my $innerline;
#-----end-----
#
# ouput i get:
# <insert millions of empty lines here>
#
# i've tracked the problem down to the "$innerline = <FIN>;" line, however
# http://www.perldoc.com/perl5.8.0/pod/func/readline.html
# indicates this is valid??
use strict;
# assuming this source file is called "line.pl"
open(FIN, "<line.pl")
or die "unable to open myself for reading!??\n";
my $outerline;
foreach $outerline (<FIN>)
{
if ($outerline =~ /outerline/)
{
my $innerline;
while (!($innerline =~ /innerline/))
{
$innerline = <FIN>;
chomp($innerline);
print "$innerline\n";
}
}
}
close(FIN);
----- end "line.pl -----
Thank you kindly for any help in advance.
--
Eric Enright /"\
ericAtiptsoftDcom \ / ASCII Ribbon Campaign
X Against HTML E-Mail
Public Key: 0xBEDF636F / \