in reply to File Extraction - Cont...

As an aside, your regex does not do what you probably think it does.

/AZII*/ checks whether there is a literal string "AZII" followed by zero or more characters "I" in $line. If you want to check for the literal string "AZII*" then you must escape the "*" as it has special meaning in a regex: /AZII\*/. It probably did not hurt you here, unless somewhere in the binary data was a sequence of bytes which translates to "AZII".

Update: Changed "AZII" to "AZI" as per apl's and johngg's (in CB) comments.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: File Extraction - Cont...
by apl (Monsignor) on Sep 26, 2007 at 09:46 UTC
    Minor nit... the pattern "AZII*" would match AZI as well as AZII, AZIII, etc.