I tried your script on a 2 socket host and 2 cpus with 4 cores.
Result: Number of CPU sockets used:1
I tried 2 simple debug outputs, perhaps it could help you:
"print $1" before you call "uniq": 0 1 0 1 0 1 0 1
"print $cpusocket" after you call "uniq": 1 1 1 1 1 1 1 1
Kind regars
I tried your script on a 2 socket host and 2 cpus with 4 cores.
Result:
Number of CPU sockets used:1
I tried 2 simple debug outputs, perhaps it could help you:
"print $1" before you call "uniq":
0
1
0
1
0
1
0
1
"print $cpusocket" after you call "uniq":
1
1
1
1
1
1
1
1
Kind regars