#! /usr/bin/perl
use warnings;
use strict;
open (PTR1, "<filename.txt") or die "Unable to open file filename.txt :
$!\n\n";
while (chomp ($str = <PTR1>))
{
sscanf($str, "%5d %11.2f", $data1, $data2);
# do whatever processing.....
}
close (PTR1);
Regards,
Amit Saxena
On Mon, Jul 14, 2008 at 8:23 PM, vikingy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> There is a file created likes this:
>
> open File ">file.txt" or die $!;
> foreach .. <..> {
> printf File "%5d %11.2f\n", $data1,data2;
> }
> close File;
>
> and my question is, how to read these data follow the same format as "%5d
> %11.2f' from this file again?
> thanks in advance!
>
> 2008-07-14
>
>
>
> The Key Lab of Complex Systems and Intelligence Science,
> Institute of Automation,
> Chinese Academy of Sciences.
>