English 中文(简体)
以每升印刷(印刷)的静态印刷价值
原标题:Printing values of stat() command with print() in perl
  • 时间:2011-11-21 12:14:35
  •  标签:
  • perl

我需要看到,“静态”指挥正在恢复。 如何做到这一点? 我使用了以下文字,但做了一些工作:

print(stat($filename"));

我指的是指挥所被处决,但并没有打印出必须归还的价值。

最佳回答

rel=“noretinger”>http://perldoc.perl.org/Functions/stat.html:

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
       $atime,$mtime,$ctime,$blksize,$blocks)
           = stat($filename);

此外,

文件:统计模块提供了方便的、按姓名分列的查阅机制:

use File::stat;
$sb = stat($filename);
printf "File is %s, size is %s, perm %04o, mtime %s
",
       $filename, $sb->size, $sb->mode & 07777,
       scalar localtime $sb->mtime;
问题回答

只是原始产出吗? www.un.org/chinese/ga/president

print (join (",", (stat($filename))), "
");

如果你永远想要淡化数据结构,我建议采用Dumper工具作为宝贵的工具。

use Data::Dumper;

print Dumper(stat($filename));

产出:

$VAR1 = 89;
$VAR2 = 1394949;
$VAR3 = 33188;
$VAR4 = 1;
$VAR5 = 1000;
$VAR6 = 20;
$VAR7 = 5574438;
$VAR8 = 100;
$VAR9 = 1320421684;
$VAR10 = 1317166549;
$VAR11 = 1317166549;
$VAR12 = 4096;
$VAR13 = 4;

doc 数据: 该模块的选择和背景细节摘要。





相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签