R
Ram Laxman
Hi all,
Iam new to perl programming. I have written a program which
read a text file and import some values to the csv file searching some
tags(keyword) in the text file.
Below is the format of text file:
No of transactions = 10
Data exchanged with device = 0.5 bytes
Data sent to device = 0.04 KBytes
while( $key = <TEXTFILE> ) {
# check if it matches the tag
if ( $key =~ /$tag/i ) {
@arr_field = split( /$tag/i, $key );
foreach $afield( @arr_field ) {
if( $afield =~ /(\d+)/ ) {
$field = $1; # extract the numerical field
}
}
print CSV "$field\,"; # writes the numerical field to the
result file
last;
The statement below extracts the numerical field.
if( $afield =~ /(\d+)/
I don't know how to extract the floating point numbers.(For example
Data exchanged with device = 0.5 bytes) without truncation and
want to save the same value in my csv file.
Could anybody help me in this regard?
Regards
Ram Laxman
Iam new to perl programming. I have written a program which
read a text file and import some values to the csv file searching some
tags(keyword) in the text file.
Below is the format of text file:
No of transactions = 10
Data exchanged with device = 0.5 bytes
Data sent to device = 0.04 KBytes
while( $key = <TEXTFILE> ) {
# check if it matches the tag
if ( $key =~ /$tag/i ) {
@arr_field = split( /$tag/i, $key );
foreach $afield( @arr_field ) {
if( $afield =~ /(\d+)/ ) {
$field = $1; # extract the numerical field
}
}
print CSV "$field\,"; # writes the numerical field to the
result file
last;
The statement below extracts the numerical field.
if( $afield =~ /(\d+)/
I don't know how to extract the floating point numbers.(For example
Data exchanged with device = 0.5 bytes) without truncation and
want to save the same value in my csv file.
Could anybody help me in this regard?
Regards
Ram Laxman