develooper Front page | perl.beginners | Postings from February 2002

Newbie: trouble reading %16g.5 format with String::Scanf

Thread Next
Christophe Trophime
February 7, 2002 01:46
Newbie: trouble reading %16g.5 format with String::Scanf
Message ID:
I am new to perl and I wish to read a mesh datadfile generated by a 
Fortran program :

/COM,ANSYS    ReLeASe    5.5.3    UP19990405    12:35:48    10/12/2001
       1       0       0 1.930000000e-02 4.726980526e-18-5.959785714e-02
       2       0       0 2.420000000e-02 1.215320474e-08-5.959779506e-02
       3       0       0 2.093333333e-02 4.051068248e-09-5.959783645e-02
       4       0       0 2.256666667e-02 8.102136492e-09-5.959781575e-02
       5       0       0 2.095782135e-02-1.209998861e-02-5.761952805e-02

I wish to read the coordinates of nodes. My problem is that the format used
to create the file is such that data for x and y may be seen as only one 
So I thought that using perl module String::Scanf may help me out because
the format of the lines is given is the datafile (i.e.  3i8 6e16.9 in 
this case).
But I can get Scanf to work with format other than %i %g. Is it possible to
use format like C format %16[gG].5? Or should I consider an alternative

Thanks for any help

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About