Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Anon Array

 
Thread Tools Search this Thread
Old 02-26-2009, 03:30 PM   #1
Default Anon Array


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:umper;

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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46