use strict; use warnings; { local $/; open my $fh, '<', 'logFile.txt' or die $!; my $data = <$fh>; while ( $data =~ / (?=\[\d{4}) # Start record \[(?.+?)\]\s* \[(?.+?)\]\s* ExecuteThread:\s*(?.+?) INFO\s*-\s*(?.+?) (?=\[\d{4}|\Z) # End record /gsx ) { print 'date: ', "$+{date}\n"; print 'active: ', "$+{active}\n"; print 'executeThread: ', "$+{executeThread}\n"; print 'info: ', "$+{info}\n"; } } #### date: 2012-09-14 16:55:22,497 active: ACTIVE executeThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) info: Well this is just one line text date: 2012-09-14 16:55:22,498 active: ACTIVE executeThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) info: Well this is just multiple line text With formats Like this ***** Some other text **** then some more text on another line date: 2012-09-14 16:55:22,499 active: ACTIVE executeThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) info: Well once again this is part starts with bracket and blah blah blah