Hi all.
Is there any way in Perl to set up an associative array of normal arrays?
So the key would be an arbitrary string, and the value for instance would be an array
of numbers.
I'll explain what I want to do, as their may well be better ways:
Suppose I have a file like this:
Hello; 1
Goodbye; 1
Hello; 2
Hello; 2
Hello; 3
Goodbye; 2
Hello; 1
Goodbye; 1
etc...
Basically, a string, with an associated number. I want to count the amount of Hello's
with a 1 next to them, and the amount of Hello's with a 2 next to them etc.
Only, I don't know what the string in the file is going to be up front.
I can count the instances of each string easily enough, ie, how many hello's there
are, but I can't see how to count Hello 2's.
I can explain this more clearly if required, as I read it and it only barely makes
sense to me.
Thanks for any tips,
Paul.
---------------------------------------------------------------------------------------------------------------------------
CRESTCo Ltd. The views expressed above are not necessarily those
33 Cannon Street. held by CRESTCo Limited.
London EC4M 5SB (UK)
+44 (020) 7849 0000 http://www.crestco.co.uk
---------------------------------------------------------------------------------------------------------------------------