in reply to Dynamic Settings from Database, $$string help
Admittedly this is kinda overkill just to store a list of ip addresses, but it's scales to many keys quite easily. You may even want to use the fetchrow_hashref() for more clarity on what data you're using from the database. Also you'll probably also want to check out info on references, using strict and data structures in perl at the least on your journey to perl mastery.my %info = ( ip => '0.0.0.0'); my @list = (); while (my @prev = $sql->fetchrow_array()){ $info{ $prev[1] } = $prev[2]; push @list, { %info }; } # example usage of created list print $_->{ip}, "\n" for @list;
_________
broquaint
|
|---|