edit RAD_REQUEST_PROXY_REPLY with perl

Jeffrey Hutzelman jhutz at cmu.edu
Fri Jan 23 03:58:58 CET 2009


--On Friday, January 23, 2009 02:10:14 AM +0100 "Tim.W" <tim at ladf.net> 
wrote:

> but I cannot for the life of me traverse the array in the hash.
> I've tried all kinds of methods with foreach and for loops, but I cannot
> get the lenght/size of the array.
> When I know i've got 3 attributes of a specific kind I can do:
>    $RAD_REQUEST_PROXY_REPLY{$t0_}[0]="newValue1";
>    $RAD_REQUEST_PROXY_REPLY{$t0_}[1]="newValue2";
>    $RAD_REQUEST_PROXY_REPLY{$t0_}[2]="newValue3";
> but I cannot find the size of $RAD_REQUEST_PROXY_REPLY{$t0_}.
>
>
> Any help in the right direction would be greatly appreciated.

Now Alan is right; you do need a Perl book, or 'perldoc perlreftut'.

The array is @{$RAD_REQUEST_PROXY_REPLY{$t0_}}
Evaluating that in scalar context will tell you the size of the array.
You can also just push values onto it:

push(@{$RAD_REQUEST_PROXY_REPLY{$t0_}}, "addedValue");

-- Jeffrey T. Hutzelman (N3NHS) <jhutz+ at cmu.edu>
   Carnegie Mellon University - Pittsburgh, PA




More information about the Freeradius-Devel mailing list