Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: using stat

by LD2 (Curate)
on Feb 10, 2003 at 18:37 UTC ( #234195=note: print w/replies, xml ) Need Help??


in reply to using stat

check out this documentation

here's an example from it:
Because the mode contains both the file type and its permissions, you +should mask off the file type portion and (s)printf using a "%o" if y +ou want to see the real permissions. $mode = (stat($filename))[2]; printf "Permissions are %04o\n", $mode & 07777;In scalar context, +stat returns a boolean value indicating success or failure, and, if s +uccessful, sets the information associated with the special filehandl +e _. The File::stat module provides a convenient, by-name access mechanism: use File::stat; $sb = stat($filename); printf "File is %s, size is %s, perm %04o, mtime %s\n", $filename, $sb->size, $sb->mode & 07777, scalar localtime $sb->mtime;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://234195]
help
Chatterbox?
[erix]: hippo I think the 26 downvotes sick
[erix]: eh, 29 downvotes
[erix]: but I guess there's no stopping the herd
[1nickt]: Thank you haukex and hippo. I'm thinking of using IPC::System:: Simple::capture instead. But will go reread Hauke's treatise first :-)
[1nickt]: herveus is so weird. Love his reply in that SQLite thread! Much more effective warning system to have diverse monks debunk on technical merits...
[haukex]: IPC::System:: Simple does all the $? handling for you, and does it well
[erix]: weird problem btw (that SQLite question) - I asked astroboy to let us know if he finds the cause
[hippo]: The syntax is warning enough to me.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2017-12-13 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (359 votes). Check out past polls.

    Notices?