MattJ83 <> wrote:
> Right - i thought it might be btter if i just paste all of the code i
> have done:
You should write your code so that its structure can be seen.
Each new block should increase the indent level.
> while (<LOG>) {
> if (/updates table/) {
> my @lines = split /\n/; {
> foreach my $info (@lines) {
>
> while (<LOG>) {
> if (/elapsed/) {
> my @lines = split /\n/; {
> foreach my $elapsed1 (@lines) {
while (<LOG>) {
if (/updates table/) {
my @lines = split /\n/; { <== what is that "{" there for?
foreach my $info (@lines) {
while (<LOG>) {
if (/elapsed/) {
my @lines = split /\n/; {
foreach my $elapsed1 (@lines) {
Now it is easy to see that control can never get to /elapsed/
unless /updates table/ matches first.
Read the line once, test it many times.
while (<LOG>) {
if (/updates table/) {
# do stuff
}
elsif (/elapsed/) {
# do other stuff
}
> I just can't get the else or elseif statements to work...........
That is because you are not writing them correctly.
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas