Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
field6 and field7 are dates with this format. e.g.field1 field2 field3 field4 field5 field6 field7 field8
All I want to do is to get this file into an array so I can manipulate it. I tried doing thisAug 11 2010 1:40PM
But it's not working. No output is produced and I can't figure out why. Any help would be gratefully receivedlocal *IN; open(IN, "/var/tmp/myfile.dat") or die "Can't read /var/tmp/myfile.dat +: $! \n"; binmode(IN); my $buf_e = ''; my $buf_d = ''; my $BLOCK_SIZE = 8192; my @recs; # Shove the contents of file into an array while (sysread(IN, $buf_e, $BLOCK_SIZE, length($buf_e))) { push(@recs, [ $1, $2, $3, $4, $5, $6, $7, $8 ]) while ($buf_d =~ s/^(\S+)\t+(\S+)\t+(\S+)\t+(\S+)\t+(\S+)\t+(\S+ +)\t+(\S+)\t+(\S+)\n//s); } close(IN); print @recs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sysread failure
by Fletch (Bishop) on Aug 11, 2010 at 13:26 UTC | |
|
Re: sysread failure
by talexb (Chancellor) on Aug 11, 2010 at 13:57 UTC | |
by ikegami (Patriarch) on Aug 11, 2010 at 15:35 UTC | |
by Anonymous Monk on Aug 11, 2010 at 14:04 UTC | |
by ikegami (Patriarch) on Aug 11, 2010 at 15:30 UTC |