Home  |  Linux  | Mysql  | PHP  | XML
From:Harry Putnam Date:Tue Mar 16 21:31:23 2010
Subject:no lstat happens
I've finally gone on around the bend, I guess... I'm not seeing why the
script below <./t2> doesn't show the value of $mode when fed by
the ls cmd shown:

(first, to shows whats here)

ls -l *[eo2]
-rw-r--r--+ 1 reader reader 5 Mar 16 15:26 one
-rwxr-xr-x+ 1 reader reader 141 Mar 16 16:19 t2
-rw-r--r--+ 1 reader reader 5 Mar 16 15:26 three
-rw-r--r--+ 1 reader reader 5 Mar 16 15:26 two


ls *[eo2] | ./t2
reader > ls *[eo2] | ./t2

(wrapped for mail)

,----
| Use of uninitialized value $mode in concatenation (.) or
| string at ./t2 line 9, <> line 1. one:
|
| [...] snipped same output for each file.
`----

Script content
cat t2
#!/usr//bin/perl
use strict;
use warnings;
my $mode;
while(<>){
chomp;
$mode = (lstat( $_))[2];
print "$_: " . $mode . "\n";
}

Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
New on http://perl-begin.org/ - more topical pages and pages for Perl uses
Re: running stats on a file
Re: use with variable
Re: stripped output from Net::SSH2
Re: 1-line datafile, need data for another routine



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants