in reply to keep track of array indexes
You don't say what you are really trying to do, but would you not be better served with a hash (aka "associative array")?
Output:#!/usr/bin/perl use strict; use warnings; my %bits = ( 4 => 'string', 1 => 'this', 3 => 'my', 2 => 'is', ); print join ' ', map $bits{ $_ }, 1 .. 4;
this is my string
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: keep track of array indexes
by AnomalousMonk (Archbishop) on Jan 02, 2016 at 19:24 UTC | |
by theleftright (Novice) on Jan 02, 2016 at 20:40 UTC | |
by choroba (Cardinal) on Jan 02, 2016 at 20:58 UTC | |
by LanX (Saint) on Jan 03, 2016 at 05:08 UTC | |
by choroba (Cardinal) on Jan 03, 2016 at 17:58 UTC | |
| |
by Cristoforo (Curate) on Jan 03, 2016 at 00:05 UTC | |
|
Re^2: keep track of array indexes
by Anonymous Monk on Jan 02, 2016 at 18:09 UTC |