Reputation: 175
I'm working with a code where integers are divided:
$length = (-s $value1/$value2);
I'm getting an error that -s is an uninitialized value. What does that -s argument mean?
Upvotes: 0
Views: 66
Reputation: 54323
The -s
operator takes a filename and returns the size in bytes, or undef
if an error occurs. One most commonly receives an error when the file doesn't exist, or when one has insufficient permissions. See -X in perldoc.
Your $value1/$value2
will return a number, and -s
will then try to find a file in the current directory with that number as its name. That likely fails, so it returns undef
.
Upvotes: 2