Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
dynamic access to multidimensional array
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Brian McCauley, post: 4741973"] #!/usr/bin/perl use strict; use warnings; sub index_AoA : lvalue { my $v = \shift; $v = \$$v->[$_] for @{shift()}; $$v; } my @AoA = ( [ "fred", "barney" ], [ "george", "jane", "elroy" ], [ "homer", "marge", "bart" ], ); my @ind = ( 0, 1 ); print index_AoA(\@AoA,\@ind),"\n"; index_AoA(\@AoA,[1,1]) = 'june'; print $AoA[1][1],"\n"; __END__ -- \\ ( ) . _\\__[oo .__/ \\ /\@ . l___\\ # ll l\\ ###LL LL\\ [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
dynamic access to multidimensional array
Top