Uh, you can... use strict; open(MYFILE,'test2.txt') or die "Can't open test2.txt: $!\n"; my @buffer=<MYFILE>; close(MYFILE);
for(@buffer) { chomp; .... But, be aware that if the file is of any size, you can run out of memory very fast and bog the system down... Why don't you just want to iterate over the lines as you are reading it? Shawn > Why can't I do something like this? Load everything to a buffer then cycle > through the buffer? > > #!/usr/bin/perl -w > open(MYFILE,'test2.txt'); > while (<MYFILE>) { > $buffer .= $_; > } > $lnum = 1; > > while ($buffer) { > chomp; > next if /^\*+/ or /^\s*$/; > my ($field, $value) = split /\s*:\s+/; > $field =~ s/^\s+//; # remove leading spaces from $field > $value =~ s/\s+$//; # remove trailing spaces from $value > print qq{$lnum: "$field","$value"\n}; > $lnum++; > }; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]