Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Capturing shell command error

by BUU (Prior)
on Jan 07, 2006 at 09:55 UTC ( [id://521706]=note: print w/replies, xml ) Need Help??


in reply to Capturing shell command error

A) eval isn't supposed to capture those sort of errors.
B) if you read the friendly man pages it mentions that backticks sets the $! error variable, so you should be checking that.
C) Why are you bothering to fork a new process and execute du? What's wrong with the built in perl operators for determing file size? Like -s?

Replies are listed 'Best First'.
Re^2: Capturing shell command error
by kulls (Hermit) on Jan 07, 2006 at 11:24 UTC
    i understand what you're saying.
    my $str=-s "upload.log"; print $str;
    How can i calculate the size for multiple files without looping like,
    i have upload1.log, upload2.log, upload3.log.
    how can i get the sizes without looping ?. How can i use upload* pattern in the -s option ?. I tried but it's not return anything.
    Can you please ?
    - kulls
      @size = map { -s $_ } glob("upload*.log");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://521706]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-23 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found