## Algorthm bug of my code

Algorthm bug of my code
# 8
10-05-2011
Thanks Mac!
I seem understanding more of your code now, but not quite sure the exact algorithm. As a learner, I'd like to confirm your logic flow with my comment for the tricky part. If this is too novice to reply, just ignore my post, although I hope to get your correction if I mis-understand it.

Thanks a lot!
# Get the file to the array @file_list
# split each row the \$id and get the \$count
# If the \$id is NOT defined, define it!
#This is the hash of hash right? using \$id as the key for the first layer of hash and \$name as key for the second layer. This part is tricky to me.
#But why the second layer of the hash need not be declared at the beginning?
# Use the hash of hash to get the value of the second layer of hash, right?
#sort is not neccessary right?
If my understanding is correct, I have made progress about the data structure with perl. Thanks a lot again!

Yifang
 yifangt View Public Profile for yifangt Find all posts by yifangt
# 9
10-06-2011
Quote:
Originally Posted by yifangt
Thanks Mac!
I seem understanding more of your code now, but not quite sure the exact algorithm. As a learner, I'd like to confirm your logic flow with my comment for the tricky part. If this is too novice to reply, just ignore my post, although I hope to get your correction if I mis-understand it.

Thanks a lot!
# Get the file to the array @file_list
# split each row the \$id and get the \$count
# If the \$id is NOT defined, define it!
#This is the hash of hash right? using \$id as the key for the first layer of hash and \$name as key for the second layer. This part is tricky to me.
#But why the second layer of the hash need not be declared at the beginning?

The second layer stores one integer only, not another hash array, so you don't need to initialize it as an empty hash like the first layer.

# Use the hash of hash to get the value of the second layer of hash, right?

Yes.

#sort is not neccessary right?

It is not neccessary, use it or not depends on your output style.

If my understanding is correct, I have made progress about the data structure with perl. Thanks a lot again!

Yifang
This User Gave Thanks to MacMonster For This Post:
 MacMonster View Public Profile for MacMonster Find all posts by MacMonster
# 10
10-06-2011
This post is really helping me a lot. Thank you very much Mac!
Yifang
 yifangt View Public Profile for yifangt Find all posts by yifangt

## Can't find the bug in my code - bombing with rename

Hi Folks - I'm encountering an issue: Scenario: We have automated GL data loads utilizing FDMEE. The problem is that some of our Locations could have multiple files. I think we are running into a situation where the script is trying to name the 2 files the same name and it is bombing out....

## is this a bug of g++?

Hello, Im using the g++(g++ Ubuntu/Linaro 4.4.4-14ubuntu5 4.4.5) and im trying to compile a small snippet code and got into an endless loop.I recompiled that in VS2010 under Windows 7 and the answer is as expected.so i wonder is this a bug of g++?here is my code. #include<iostream> using...

## where's the bug?

#!/bin/bash if then #echo "infinite loop" exit 0 fi when I run this file I get the following error: ./test_infinite_loop: line 5: syntax error near unexpected token `fi' ./test_infinite_loop: line 5: `fi' :confused:

## top's exit code indicates error--is this a bug?

This single line of code in a sh script file top -b -n 1 -U \$USER causes the script to prematurely exit with an exit code of 1 (i.e. an error) if the script is run with the -e option (e.g. if set -e is executed near the top of the script file). Alternatively, you can execute it like top...

## bug in 43 ???

xxxxserver# lsattr -El inet0 | grep 255.240.0.0,32.224.0.0,32.78.120.254 | grep '.40' route net,-hopcount,1,-netmask,255.240.0.0,32.224.0.0,32.78.120.254 How this is possible?

## Is it a bug ..?

Hi All, I am using Red Hat Linux on my servers. The problem that I am facing is, sometimes the /opt usage on the server shows used percentage as 100% , when actually it is simply 20%. When I reboot the system, it comes back to 20%.Is this a bug in the system or my settings have gone wrong...

## Can anyone find a bug in this code?? shell script

I have done a script and IT WORKS JUST PERFECT from command line...but in cron it has problems executing... nawk -F"|" ' { s=substr(\$104,2,18)} {b ++s} END { for (i in b) print i, b } ' \$1 > /path/to/files/TranId_w\$2 q=`cat /path/to/files/TranId_w\$2 | wc -l` echo \$q >...