![]() |
|
|
|
#1 |
|
Hi,
I'm looking for a better way to use the contents of an anonymous array. This is what I've done so far: #!/usr/bin/perl # use strict; use Data: my (%test,@numbers,$key,$value,$index); @numbers = (1,2,3); $test{"base_0"} = [ @numbers ]; print STDOUT ("test\{\"base_0\"\}= ".Dumper($test{"base_0"})."\n"); $test{"base_10"} = [ map ($_+10, @numbers)]; print STDOUT ("test\{\"base_10\"\}= ".Dumper($test{"base_10"})."\n"); foreach $key (sort keys (%test)) { print STDOUT ("ref\(test\{$key\}\)= ".ref($test{$key})."\n"); $index = 0; until (!$test{$key}[$index]) { print STDOUT ("value\[$index\]= ".$test{$key}[$index]."\n"); $index ++; } } It's kinda ugly to do it this way. Any suggestion(s)? Thanks. The Owner |
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VHDL and EDK: Custom IP core containing an array as a port using EDK | allsey_1987 | Hardware | 0 | 10-27-2009 02:26 PM |
| constants as of array of integers, for loops | octavsly | Hardware | 0 | 04-25-2009 11:53 AM |
| How to retrieve array parameter ( JAVA ) | naruponk | Software | 1 | 04-16-2009 10:20 AM |
| Array Programme | rits | Software | 2 | 03-04-2009 05:18 PM |
| need help Invalid length for a Base-64 char array | rrwestva | Hardware | 0 | 07-04-2006 09:36 PM |