M
mike.wilson8
I'm substr from a sas report and loading numbers into a hash
table..code below
$MsgRate = substr($thisline,59,5);
$MsgRate =~ s/\s+$//;
$MsgRate =~ s/^\s+//;
if (! exists
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{$MsgRate})
{
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{'MsgRate'} = $MsgRate;
print ("hash read,
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{'MsgRate'}\n")
}
** The last line of code above is a print test statement just to make
sure I was loading the numbers okay, and I am.
Last step--I'm opening and running a report (code below), but instead
of seeing numbers from $MsgRate which I validated above, the report is
just spitting out the word MsgRate. Any ideas?
open(RPT,">$rptname") || die "Cannot open $rptname\n";
for $crs ( sort keys%crsCode)
{
for $source ( sort keys%{$crsCode{$crs}})
{
for $pcc ( sort keys%{$crsCode{$crs}{$source}})
{
for $TransactionType ( sort
keys%{$crsCode{$crs}{$source}{$pcc}})
{
for $MsgRate ( sort
keys%{$crsCode{$crs}{$source}{$pcc}{$TransactionType}})
{
print(RPT
"${greg}\t${hour}\t${crs}\t${source}\t${pcc}\t${TransactionType}\t${MsgRate}\n");
}
}
}
}
}
table..code below
$MsgRate = substr($thisline,59,5);
$MsgRate =~ s/\s+$//;
$MsgRate =~ s/^\s+//;
if (! exists
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{$MsgRate})
{
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{'MsgRate'} = $MsgRate;
print ("hash read,
$crsCode{$crs}{$source}{$pcc}{$TransactionType}{'MsgRate'}\n")
}
** The last line of code above is a print test statement just to make
sure I was loading the numbers okay, and I am.
Last step--I'm opening and running a report (code below), but instead
of seeing numbers from $MsgRate which I validated above, the report is
just spitting out the word MsgRate. Any ideas?
open(RPT,">$rptname") || die "Cannot open $rptname\n";
for $crs ( sort keys%crsCode)
{
for $source ( sort keys%{$crsCode{$crs}})
{
for $pcc ( sort keys%{$crsCode{$crs}{$source}})
{
for $TransactionType ( sort
keys%{$crsCode{$crs}{$source}{$pcc}})
{
for $MsgRate ( sort
keys%{$crsCode{$crs}{$source}{$pcc}{$TransactionType}})
{
print(RPT
"${greg}\t${hour}\t${crs}\t${source}\t${pcc}\t${TransactionType}\t${MsgRate}\n");
}
}
}
}
}