On 12-05-17 05:24 PM, Chris Stinemetz wrote:
Thank you Uri and Shawn.
I am getting the following error and not sure how to resolve:
I will also checkout the great suggestions Uri made.
Can't use string ("3") as an ARRAY ref while "strict refs" in use at
./DBSRtest.pl line 51,<> line 999.
#!/usr/bin/perl
use warnings;
use strict;
use POSIX;
use Data::Dumper;
# Make Data::Dumper pretty
$Data::Dumper::Sortkeys = 1;
$Data::Dumper::Indent = 1;
# Set maximum depth for Data::Dumper, zero means unlimited
local $Data::Dumper::Maxdepth = 0;
# configuration
my $fileOut = "testOut.txt";
my $field_separator = quotemeta( ';' );
my $ICELL_INDEX = 9;
my $ISECT_INDEX = 10;
my $ICHAN_INDEX = 27;
my $CFC_INDEX = 36;
my $CFCQ_INDEX = 37;
my $RTD_INDEX = 40;
my $fileIn =
sprintf("/omp/omp-data/logs/pcmd/%s.PCMD",strftime("%y%m%d%H",localtime));
print $fileIn,"\n";
#my $fileOut =
sprintf("/home/cstine/tools/DBSR/%s.txt",strftime("%y%m%d%H%M",localtime));
open my $fin, '<', $fileIn or die "ERROR opening $fileIn: $!";
open my $out, '>', $fileOut or die "ERROR opening $fileOut: $!";
#print "Icell\t Isect\t Ichan\t cfc\t cfcq\t rtd\t";
my @fields;
while(<> ) {
next unless /;/;
chomp;
my @data = split /;/;
my($Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd) = @data[$ICELL_INDEX,
$ISECT_INDEX, $ICHAN_INDEX, $CFC_INDEX, $CFCQ_INDEX, $RTD_INDEX];
if( $Icell>= 1&& $Isect>= 1&& $Ichan>= 1&& $cfc>= 1&&
$cfcq>= 1&& $rtd>= 1) {
$rtd = sprintf "%.2f", $rtd/8/6.6/2;
push(@fields, $Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd);
# push an anonymous array for each record
push @fields, [ $Icell,$Isect,$Ichan,$cfc,$cfcq,$rtd ];
}
}
my @sorted_fields = sort {
$a->[0]<=> $b->[0]
|| $a->[1]<=> $b->[1]
|| $a->[2]<=> $b->[2]
|| $a->[3]<=> $b->[3]
|| $a->[4]<=> $b->[4]
|| $a->[5]<=> $b->[5]
} @fields;
print Dumper \@fields;
Thank you,
Chris
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
_Perl links_
offical site : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help : http://perlmonks.org/
documentation : http://perldoc.perl.org/
news : http://perlsphere.net/
repository : http://www.cpan.org/
blog : http://blogs.perl.org/
regional groups : http://www.pm.org/
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/