dReKurCe has asked for the wisdom of the Perl Monks concerning the following question:
Nlink 1
#! /usr/bin/perl use warnings; use strict; my (%inf,@info,@keys,$phile,$key,$value); use Cwd; my $dir=Cwd->getcwd(); opendir(DIR,"$dir")or die "@!"; while ( $phile=readdir(DIR)){ if($phile=~/^\.$/){next;} elsif($phile=~/^\.\.$/){next;} elsif($phile=~/^(.*)$/) {print "$phile\n";info($phile)} info ($phile); } sub info{ @info=stat($phile); @keys=qw(Dev Inode Mode NLink UID GID RDev Size +ATime CTime Blksize Blocks); @inf{@keys}=@info; } ($key,$value)=each %inf; print "@info\n"; print "$key,$value";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Assigning keys and values to a hash using arrays
by Tanktalus (Canon) on Dec 06, 2005 at 14:25 UTC | |
|
Re: Assigning keys and values to a hash using arrays
by blazar (Canon) on Dec 06, 2005 at 14:40 UTC | |
|
Re: Assigning keys and values to a hash using arrays
by dReKurCe (Scribe) on Dec 06, 2005 at 18:27 UTC |