CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [gevni] How to store unknown Array into Hash?: Edit Log



BillKSmith
Veteran

Dec 23, 2012, 12:12 PM


Views: 3399
Re: [gevni] How to store unknown Array into Hash?

No loop is needed, use an array slice.

Code
use strict; 
use warnings;
my @join_array = ([qw(AA BB CC DD)]);
my @tmp = (2, 1, 0, 3);
my @array_index = @{$join_array[0]}[@tmp];
print "@array_index\n";


OUTPUT

Code
CC BB AA DD


Edit: Added output
Good Luck,
Bill

(This post was edited by BillKSmith on Dec 24, 2012, 7:25 AM)


Edit Log:
Post edited by BillKSmith (Veteran) on Dec 24, 2012, 7:25 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives