r huber wrote:
> Is the a formatted read in perl? I have fixed length
> records that need to be split up into separate
> fields/variables and there is no delimiter. I've
> checked my perl book and can not find anything other
> than doing a series of substr's.

You can set the Input Record Separator to a reference to the record length:

$/ = \1234;

while ( my $record = <FILE> ) {

    # $record contains 1,234 bytes from the file


And then use unpack to retrieve the individual fields:

    my @fields = unpack 'a10 a3 a16 a5', $record;




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to