Unix Programming - Newbie with stat(_) problem

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2004 > Newbie with stat(_) problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Newbie with stat(_) problem
Ian Pellew

2004-11-19, 5:51 pm

Hi All;

Code fragment to - if necessary, compile one file from another:-
I have titted around with Stat() as per Active PERL User Guide,
but lack the brains to work out why I can't get it to PERL compile.

From an XMLin string I split it for the two files:-
.. . . . . .
my @s = split /=/, $d;
for (scalar @s) {
if (/2/) {
my $make = $true;
if ( -r (my $sf = ${s[1]})) { # do we have the src?
if ( -w (my $tf = ${s[0]})) { # Is the target already made?
$i = stat($tf); # cannot get $i = (stat(${s[1]}))[9] to work
????
$i = @$i[9]; # Mtime
$j = stat($sf);
$j = @$j[9];
if ( $j < $i ) { $make=$false; print qq(Target is younger than the
source, So nothing to do.\n);}
} else {
$make = $true;
}
} else { Ummmmmmmm no src }
}
. . . . . . .

I think my problem is not understanding what a @$xx is.
The Mtime test should have a comparison of two stats rather than
amatuer effort.

Regards
Ian
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com