Octavian Rasnita wrote: > Hi, Hello,
> I have a program that contains a pretty big block of text: > > my $text = <<EOF; > line1 > line2 > ... > line 120000 > EOF > > I want to read this block of text line by line and analyse each line without > needing to create a big array that contains all these lines (exactly like > when reading line by line from a text file). > > It works fine if the program contains just a block of text, because in that > case I can put the data after __DATA__ and then use while(<DATA>), but the > program contains 2 blocks of text. > > Is there a solution for this? Use open on $text like: $ perl -e' my $text = <<TEXT; one two three four TEXT open my $fh, q[<], \$text or die $!; while ( <$fh> ) { print "$.: $_"; } ' 1: one 2: two 3: three 4: four John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>