...or line by line, but build up records based on STORExxx:
use strict;
use warnings;
use Data::Dumper;
my @header = map { chomp( my $line = <DATA> ); $line } 0 .. 1; # Grab
+1st 2
my $store = '';
my %records;
while ( my $line = <DATA> ) {
chomp $line;
next unless length $line;
if( $line =~ m/\s(STORE\d{3})/ ) {
$store = $1;
next;
}
$records{ $store } .= $line . "\n";
}
print Dumper \@header;
print Dumper \%records;
__DATA__
STORE MONITORING REPORT as of 13-05-02 10:05:07
Scanning for FTFIMS
STORE002
-rwxr-xr-- 1 admins store 59025 Apr 11 2012 eft100.cbr
16295 58
-rwxr-xr-- 1 admins store 61143 Nov 15 15:47 chk075.cbr
33334 60
-rwxr-xr-- 1 admins store 420952 Sep 6 2012 test-encrypt
63327 412
-rwxr-xr-- 1 admins store 427068 Sep 6 2012 eft115-20
36184 418
-rwxr-xr-- 1 admins store 460694 Apr 3 06:15 eft6un
07640 450
-rwxrwxrwx 1 admins store 481069 Oct 4 2012 hostsocgw
46087 470
-rwxrwxrwx 1 admins store 503666 Feb 13 09:10 stratgw
22452 492
-rwxr-xr-- 1 admins store 14318 Nov 1 2010 unityrep
50196 14
STORE006
-rwxr-xr-- 1 admins store 59025 Apr 11 2012 eft100.cbr
16295 58
-rwxr-xr-- 1 admins store 61143 Nov 15 15:47 chk075.cbr
33334 60
-rwxr-xr-- 1 admins store 420952 Sep 6 2012 test-encrypt
63327 412
-rwxr-xr-- 1 admins store 427068 Sep 6 2012 eft115-20
36184 418
-rwxr-xr-- 1 admins store 460694 Apr 3 06:15 eft6un
07640 450
-rwxrwxrwx 1 admins store 481069 Oct 4 2012 hostsocgw
46087 470
-rwxrwxrwx 1 admins store 503666 Feb 13 09:10 stratgw
22452 492
-rwxr-xr-- 1 admins store 14318 Nov 1 2010 unityrep
50196 14
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|