On Feb 4, Bob Showalter said:

>Christopher M Burger wrote:
>> I was wondering if anyone had any ideas on how to parse a datafile
>> with fixed length records but no carriage returns.  All records are
>> on one line.
>
>The read() function lets you read a fixed block of bytes.

So does the <> operator, if you set $/ to a reference to a number.

>   while(read(F, $buf, 65)) {

Can be:

  $/ = \65;
  while (<F>) {

>      my ($f1, $f2, $f3) = unpack 'a10 a15 a40', $_;

Also, Bob, you read into $buf, but you're upacking $_.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to