in reply to Re: Splitting file into separate files based on record lengths and identifiers
in thread Splitting file into separate files based on record lengths and identifiers

Oh and I'd love you to break out the logic of your script, would much rather understand than blindly copy!

Thanks!

  • Comment on Re^2: Splitting file into separate files based on record lengths and identifiers

Replies are listed 'Best First'.
Re^3: Splitting file into separate files based on record lengths and identifiers
by kennethk (Abbot) on Aug 25, 2010 at 22:31 UTC
    The most fundamental difference between my code and that posted in Re: Splitting file into separate files based on record lengths and identifiers is the use of ^ in my regular expressions. ^ requires that the match start at the beginning of the string. Unlike some regular expression implementations (Java comes to mind), without that anchor Perl can begin a match anywhere in the string. The likely issue you are having with your posted code is that your order of operations is getting messed up because you may start in the middle of your string. My approach requires that you process the string in order.