At 03:12 PM 11/14/01 +1030, Daniel Falkenberg wrote:
>Hey all,
>
>I have some user details that I want placed in this graph. Probem is my
>Perl skills arn't all that good. Could some one give me some ideas with
>the following?
>
>I have a hash here (%users) the Key here is their static IP address.
>The value is just some data. Now the problem I am having is that in my
>@data below I need the Key to be placed on the X axis and the data to be
>placed on the Y axis.
>
>%users = (
> '192.168.30.15' => '0.0365829467773438',
> '192.168.30.232' => '0.927815437316895',
> '192.168.30.32' => '0.159876823425293'
> );
>
>
>
>my @data = (
> [ "192.168.30.15", "192.168.30.232", "192.168.30.32"],
> [ $valueofhash1, $valueofhash2, $valueofhash3, ],
>);
>
>Now the rest is pretty straight foward. I could manually placed these
>in but if someone else is added to the hash then I don't really want to
>have to be adding it manually each time to @data. Could some one give
>me some ideas on what I would do here?
Are you looking for something like this:
my @x = sort keys %users;
my @data = (\@x, [ @users{@x} ]);
I'm assuming you want to sort the keys, otherwise you could just do
my @data = ([keys %users], [values %users]);
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]