in reply to Arrays manipulation
#!/usr/bin/perl -w use strict; use Data::Dumper; my @array = ('nfs,7,rw', 'afp,12,rro', 'cifs,32,ro', 'dns,5,rw', ); my $cols = []; foreach my $row (0..$#array) { my @cols = split /,/, $array[$row]; map {$cols->[$_]->[$row] = $cols[$_]} (0..$#cols); } print Dumper($cols);
$VAR1 = [ [ 'nfs', 'afp', 'cifs', 'dns' ], [ '7', '12', '32', '5' ], [ 'rw', 'rro', 'ro', 'rw' ] ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Arrays manipulation
by sauoq (Abbot) on May 01, 2003 at 09:16 UTC | |
by Aristotle (Chancellor) on May 02, 2003 at 00:56 UTC | |
by sauoq (Abbot) on May 02, 2003 at 18:46 UTC | |
by Aristotle (Chancellor) on May 03, 2003 at 00:57 UTC | |
by sauoq (Abbot) on May 03, 2003 at 01:47 UTC | |
|