>>> "Newell, Paul" <[EMAIL PROTECTED]> 02/06/01 05:11PM >>>
Greg,
OK. You may have figured this out already but to "jump" to a place in a file
you are reading you could:
while (<HANDLE>) { # I forgot what <HANDLE> was in your script.
last if /^EDI_ASN_D/;
}
or something like that. You then have to find a way to push the line
/EDI_ASN_D/ matched back so it will be handled by the appropriate logic.
You might be able to do that with tell and seek. E.g:
while (<HANDLE>) {
last if /^EDI_ASN_D/;
$curpos = tell( HANDLE );
}
seek (HANDLE, $curpos, 0) if /^EDI_ASN_D/;
# should work since $_ is global
so the subsequent read would re-read the last line and pass it through the
same logic.
(Assuming this works for non-binary reads. I have never done anything like
this so I don't really know if I am leading you in the right direction.
Someone on the list can probably yell at me if I'm really off base.)
-Paul Newell
From: Greg Wardawy [mailto:[EMAIL PROTECTED]]
>
> What I'm trying to do is:
>
> Print DOC HEADER, HEADER, EDI_ASN and then the first EDI_CONT
> line with EDI_CONT_D lines, skip everything up to the second
> EDI_ASN_D line, skip the first EDI_CONT/EDI_CONT_D segment,
> print the second EDI_CONT/EDI_CONT, go to the third EDI_ASN_D
> segment and print the third EDI_CONT/EDI_CONT_D segment, go
> to the fourth EDI_ASN_D segment and so long up to the end.
> And in the meantime I have to correct all the "counters". By
> putting next unless (/EDI_ASN_D/) after a print statement in
> the EDI_CONT_D block I was trying to jump to the next
> EDI_ASN_D. I was wrong and I have to re-think the problem.
> Thank you, Paul.
>
> Greg
Thank you, Paul
I'm not familiar with a tell and seek, have to read docs and try it. I've been trying
to use BD_File and the tied hash but I felt into the problems (my post "lost in the
quagmire of hashes") building a multidimensional hash and then using the data from
that hash - not enough knowledge and experience, just "trial and error". Well, I'll
have to find another way. And for sure I gonna try a tell and a seek. Thank you again.
Greg
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users