Thanks Chris
I am trying to build a sub routine that computes the following equation
When $data[262] has the value of 1
Take the value of $data[261] and return the solution of:
$data[261]+13)/6.6/8/2*10)/10
When I call the sub routine before I push the array I would like to return the
value in 0.1 decimal.
#!/usr/bin/perl
use warnings;
use strict;
my $filepath = 'C:/temp/PCMD';
my $outfile = 'output.txt';
open my $fh, '<', $filepath or die "ERROR opening $filepath: $!";
open my $out, '>', $outfile or die "ERROR opening $outfile: $!";
my @array = ();
while (<$fh>){
next unless /;/;
chomp;
my @data = split /;/;
my($cell,$sect,$chan,$carr,$dist,$precis) =
($data[31],$data[32],$data[38],$data[39],$data[261],$data[262]);
if ($data[38] == 15)
{
$data[39] = 2;
} else {
$data[39] = 1;
}
if( length($data[261]) > 12)
{
$dist = getDist;
}
else
{
$dist = "";
}
push @array, {
cell => $cell,
sect => $sect,
carr => $carr,
RTD => $RTD,
};
}
my @sorted = map { $_->[0] }
sort {
$a->[1] <=> $b->[1]
|| $a->[2] <=> $b->[2]
|| $a->[3] <=> $b->[3]
}
map { [ $_, $_->{cell}, $_->{sect}, $_->{carr} ]}
@array;
for my $tuple ( @sorted ){
print "$tuple->{cell} $tuple->{sect} $tuple->{carr} $tuple->{RTD}\n";
}
for my $tuple ( @sorted ){
print $out "$tuple->{cell} $tuple->{sect} $tuple->{carr} $tuple->{RTD}\n";
}
close $out;
###############################################################
# Round Trip Delay
# Indicates the precision of the Round Trip Delay. If 1, Round
# Trip Delay is in units of 1/8 chip (0.125). If 32, Round Trip Delay
# is in units of 4 chip.