I'm confused with the usage of square bracketed comma delimited elements in perl:
[short($file), -s $file];
Can somebody tell me what does this code mean?
[]
creates an array reference.
[ $scalar, $scalar ]
creates an array reference with two items in it.
short($file)
calls a subroutine and returns something (probably a scalar or a list of scalars)
-s $file
gives you the size of the file (as a scalar).
[short($file), -s $file]
gives you an array ref containing the above two things.
It creates a reference to an array with two items, the result of a function call to short($file)
and the size of the $file
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With