Stuart White wrote:
> > > In the end, I want @SAN to have all the unique
> > names
> > > within the file. Any ideas?
> > You just described a Hash. Use %hash and then
> > either uppercase or lowercase the the incoming key.
> > YOu could then add a count to the Hash so you know
> > you are l
This worked perfectly! Thanks.
--- James Edward Gray II <[EMAIL PROTECTED]>
wrote:
> On Mar 8, 2004, at 4:19 PM, Stuart White wrote:
>
> > Conceptually, what you say the result is, is what
> I
> > want, thanks. When I read it though, without the
> > comment, I'd guess that the program would pa
> If you want the teams and players to be unique you
> should probably use a
> hash of hashes (HoH):
>
Eventually, I think I'll use that, but not yet. Baby
steps. :) thanks.
> my %stats;
> while ( ) {
> my ( $t, $p ) = /\[($team)\] ($player)/ or next;
> $stats{ $t }{ $p } = ();
>
>
> This is where the work gets done, yes. In English
> it reads, for every
> word in the array, add one to the corresponding hash
> value under that
> key. That will give you a hash with keys for all
> the words. Their
> values will be the number of times that word
> appeared in the array.
>
Stuart White wrote:
>
> I'm reading in lines of text, and extracting the
> relevant parts of it. These relevant parts are then
> being pushed onto an array. My trouble is that these
> parts are a maximum of 24 unique names. However, when
> pushed onto the array, there is no mechanism for
> comp
On Mar 8, 2004, at 4:19 PM, Stuart White wrote:
Conceptually, what you say the result is, is what I
want, thanks. When I read it though, without the
comment, I'd guess that the program would pair those
words like so:
dog:cat, dog:lizard, dog:wombat
with dog:lizard overwriting dog:cat, and dog:wom
--- James Edward Gray II <[EMAIL PROTECTED]>
wrote:
> On Mar 8, 2004, at 1:24 PM, Stuart White wrote:
>
> > If I had a hash, I'd have to have a key and a
> value
> > though. I'm just looking for one or the other. I
> > suppose I could have key value pairs in the %SAN
> hash
> > like so:
>
> Pe
--- "Wagner, David --- Senior Programmer Analyst ---
WGO" <[EMAIL PROTECTED]> wrote:
> Stuart White wrote:
> >>> In the end, I want @SAN to have all the unique
> names
> >>> within the file. Any ideas?
> >>You just described a Hash. Use %hash and then
> >> either uppercase or lowercase the th
On Mar 8, 2004, at 1:37 PM, James Edward Gray II wrote:
my @words = qw(dog cat dog lizard dog wombat dog);
my %seen;
foreach (@words) {
$seen{$_}++;
}
my @words = keys %seen;
Egad, I'm dumb today, drop the my in the above line. Sorry.
print "@words\n"; # only prints one dog
James
--
To
On Mar 8, 2004, at 1:24 PM, Stuart White wrote:
If I had a hash, I'd have to have a key and a value
though. I'm just looking for one or the other. I
suppose I could have key value pairs in the %SAN hash
like so:
Perl hashes are pretty versatile. As Wags was saying, just stick each
item in the
Stuart White wrote:
>>> In the end, I want @SAN to have all the unique names
>>> within the file. Any ideas?
>> You just described a Hash. Use %hash and then
>> either uppercase or lowercase the the incoming key.
>> YOu could then add a count to the Hash so you know
>> you are looking at all
> > In the end, I want @SAN to have all the unique
> names
> > within the file. Any ideas?
> You just described a Hash. Use %hash and then
> either uppercase or lowercase the the incoming key.
> YOu could then add a count to the Hash so you know
> you are looking at all things or not. The k
Stuart White wrote:
> I'm reading in lines of text, and extracting the
> relevant parts of it. These relevant parts are then
> being pushed onto an array. My trouble is that these
> parts are a maximum of 24 unique names. However, when
> pushed onto the array, there is no mechanism for
> compari
13 matches
Mail list logo