On 11/05/2011 08:07 AM, Ken Peng wrote:
于 2011-11-5 16:57, Uri Guttman 写道:
it isn't confusing. when a system call error occurs, you get an undef
return value which says that. then you check $! to see what was the
error. clearing $! on all good calls is a waste of cpu since most calls
succeed vs the number that fail. the same is true for $@ when an eval
fails. you check the return value of the eval and if needed, then check
the value of $@ for what the error was.

Then where did it get the error and set up the value of $! in my first
post?

i keep telling you, there was no error. as for the value, $! has both a string and numeric value.

perl -le 'print( $! + 0 )'
0

so it was set to 0 like most variables in a program before it is run (the bss segment of a process if you know what that is). you are just printing the default value of $! which is meaningless since you generated no actual error. please get that. there was no error in your code so you should not print $!. you only check it if you actually got an error (an undef) from a system call.

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to