Why use zip at all, when a slice assignment will work just fine.
And you can just as easily do it inline if you want.#!/usr/bin/perl -w use strict; use List::MoreUtils qw(:all); use Test::More no_plan => 1; my @labels =qw(dev ino mode nlink uid gid rdev size atime mtime ctime +blksize blocks); my @stat = stat "/tmp"; my $stat = { zip @labels, @stat }; my %stat; @stat{@labels} = @stat; is_deeply($stat, \%stat, '... look twins!');
However, I think nothingmuch has the right idea, use a module.use strict; use Data::Dumper; my %stat; @stat{ qw(dev ino mode nlink uid gid rdev size atime mtime ctime blksize +blocks) } = (stat "/tmp"); print Dumper \%stat; __OUTPUT__ $VAR1 = { 'blksize' => 4096, 'ctime' => 1156800398, 'rdev' => 0, 'blocks' => 0, 'uid' => 0, 'dev' => 234881026, 'mtime' => 1156800398, 'mode' => 17407, 'size' => '238', 'nlink' => 7, 'atime' => 1156749300, 'ino' => 5795297, 'gid' => 0 };
In reply to Re: using List::MoreUtils::zip with anon arrays ?
by stvn
in thread using List::MoreUtils::zip with anon arrays ?
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |