Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Need some data structures cooked

by UnderMine (Friar)
on Nov 19, 2002 at 21:43 UTC ( [id://214276]=note: print w/replies, xml ) Need Help??


in reply to Need some data structures cooked

#!/usr/bin/perl use strict; use simplegraph; $iteration = 0; $servers={'64.210.209.50' => { domain => 'www.zwire.com', scale => 3500, vips => [], }, '64.210.209.51' => {}, };
Trap your errors .. and link/unlink.

splice (@{$vips{$k}{'stack'}},0,$#{$vips{$k}{'stack'}}-50) if ($#{$vip +s{$k}{'stack'}}>50);
Hope this helps
UnderMine

Replies are listed 'Best First'.
Re: Re: Need some data structures cooked
by petral (Curate) on Nov 21, 2002 at 15:55 UTC
    Well cooked!  Oddly enough, all you need is:    splice @{$vips{$k}{'stack'}}, 0, -50; It will leave the array untouched if it is not greater than 50.
    $ perldoc -f splice . . . If LENGTH is negative, leaves that many elements off the end of the + array.
    (I guess they mean "off the deleted array" -- at all events, that's how it works (and also what makes sense).  It's explained clearly here!)

      p

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://214276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found